www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/21/23:32:12

Message-ID: <353CE1A6.9F31B26F@lasalle.edu.co>
Date: Tue, 21 Apr 1998 18:12:54 +0100
From: "MAPE." <mpereze AT lasalle DOT edu DOT co>
Organization: MAPE
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Eof().TC -> ??.Djgpp!!

--------------4D545CCF286D391657F8F67E
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi, I write to you becouse I have one problem.. I am converting a source
file,  that I wrote in Turbo C++ , to be builded with DJGPP and it
appears that the function int eof(int handle) has no subsittute in
Djgpp, which only offers int feof(FILE  *file). I have tryed to use
FILE *fdopen(int fd, const char *mode) thinking that fd is the handle,
and then my program goes malfunctioning. Will I have to replace all the
file tratement with handles by a one based on FILE pointers?
Here is the fragmente of code:

/*buscar en bufer nuevo y reeemplazar ocurrencias si las hay*/
  do{
       Kpos_buf=buscar_buf(cad_comp+Offset,ASCII_Obj);
       if(Kpos_buf>=0) /*Encontró una coincidencia*/
       {
            /*Dicha coincidencia debe ser reemplazada*/
            for(Num=0;Num<TamCad;Num++){
            *(cad_comp+Offset+Kpos_buf+Num)=ASCII_Reem[Num];}
        }
       Offset=Kpos_buf+TamCad;
  }while(Kpos_buf>=0);

  /*No hubo o no hay más coincidencias en el buffer actual,
     así que guardar el buffer actual y cargar el siguiente..
     Se devuelve el puntero, se escribe y queda en la misma posición
listo para
     leer el siguiente bloque*/

   lseek(Handle,pos_arch,SEEK_SET);
   if(tamano<Buffer){
      write(Handle,cad_comp,(unsigned)(tamano));}
   else{
    write(Handle,cad_comp,(unsigned)(Buffer));}
  pos_arch+=Buffer;
 } while(pos_arch<=tamano && !eof(Handle) && Accion==2);

This portion of function works fine for me int TC++ 3.0 but I dont know
wich is the replace of eof for working in Djgpp..

Thank you.

--
MAPE>> Miguel Angel Pérez Estrada.
Ing. Diseño y Automatización,  Universidad de La Salle
mpereze AT atenea DOT lasalle DOT edu DOT co; http://www.lasalle.edu.co/~mpereze
Apartado Aéreo 3957, Santafé de Bogotá D.C., COLOMBIA.


--------------4D545CCF286D391657F8F67E
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Hi, I write to you becouse I have one problem.. I am converting a source
file,&nbsp; that I wrote in Turbo C++ , to be builded with DJGPP and it
appears that the function <I>int eof(int handle) </I>has no subsittute
in Djgpp, which only offers <I>int feof(FILE&nbsp; *file). </I>I have tryed
to use&nbsp; FILE *fdopen(int fd, const char *mode) thinking that fd is
the <I>handle</I>, and then my program goes malfunctioning. Will I have
to replace all the file tratement with handles by a one based on FILE pointers?
<BR>Here is the fragmente of code:

<P>/*buscar en bufer nuevo y reeemplazar ocurrencias si las hay*/
<BR>&nbsp; do{
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Kpos_buf=buscar_buf(cad_comp+Offset,ASCII_Obj);
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(Kpos_buf>=0) /*Encontr&oacute;
una coincidencia*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
/*Dicha coincidencia debe ser reemplazada*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
for(Num=0;Num&lt;TamCad;Num++){
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
*(cad_comp+Offset+Kpos_buf+Num)=ASCII_Reem[Num];}
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Offset=Kpos_buf+TamCad;
<BR>&nbsp; }while(Kpos_buf>=0);

<P>&nbsp; /*No hubo o no hay m&aacute;s coincidencias en el buffer actual,
<BR>&nbsp;&nbsp;&nbsp;&nbsp; as&iacute; que guardar el buffer actual y
cargar el siguiente..
<BR>&nbsp;&nbsp;&nbsp;&nbsp; Se devuelve el puntero, se escribe y queda
en la misma posici&oacute;n listo para
<BR>&nbsp;&nbsp;&nbsp;&nbsp; leer el siguiente bloque*/

<P>&nbsp;&nbsp; lseek(Handle,pos_arch,SEEK_SET);
<BR>&nbsp;&nbsp; if(tamano&lt;Buffer){
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write(Handle,cad_comp,(unsigned)(tamano));}
<BR>&nbsp;&nbsp; else{
<BR>&nbsp;&nbsp;&nbsp; write(Handle,cad_comp,(unsigned)(Buffer));}
<BR>&nbsp; pos_arch+=Buffer;
<BR>&nbsp;} while(pos_arch&lt;=tamano &amp;&amp; !eof(Handle) &amp;&amp;
Accion==2);

<P>This portion of function works fine for me int TC++ 3.0 but I dont know
wich is the replace of eof for working in Djgpp..

<P>Thank you.

<P>--
<BR>MAPE>> Miguel Angel P&eacute;rez Estrada.
<BR>Ing. Dise&ntilde;o y Automatizaci&oacute;n,&nbsp; Universidad de La
Salle
<BR>mpereze AT atenea DOT lasalle DOT edu DOT co; <A HREF="http://www.lasalle.edu.co/~mpereze">http://www.lasalle.edu.co/~mpereze</A>
<BR>Apartado A&eacute;reo 3957, Santaf&eacute; de Bogot&aacute; D.C., COLOMBIA.
<BR>&nbsp;</HTML>

--------------4D545CCF286D391657F8F67E--



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019