Mail Archives: djgpp/1998/04/21/23:32:12
--------------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, 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 *file). </I>I have tryed
to use 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> do{
<BR> Kpos_buf=buscar_buf(cad_comp+Offset,ASCII_Obj);
<BR> if(Kpos_buf>=0) /*Encontró
una coincidencia*/
<BR> {
<BR>
/*Dicha coincidencia debe ser reemplazada*/
<BR>
for(Num=0;Num<TamCad;Num++){
<BR>
*(cad_comp+Offset+Kpos_buf+Num)=ASCII_Reem[Num];}
<BR> }
<BR> Offset=Kpos_buf+TamCad;
<BR> }while(Kpos_buf>=0);
<P> /*No hubo o no hay más coincidencias en el buffer actual,
<BR> así que guardar el buffer actual y
cargar el siguiente..
<BR> Se devuelve el puntero, se escribe y queda
en la misma posición listo para
<BR> leer el siguiente bloque*/
<P> lseek(Handle,pos_arch,SEEK_SET);
<BR> if(tamano<Buffer){
<BR> write(Handle,cad_comp,(unsigned)(tamano));}
<BR> else{
<BR> write(Handle,cad_comp,(unsigned)(Buffer));}
<BR> pos_arch+=Buffer;
<BR> } while(pos_arch<=tamano && !eof(Handle) &&
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érez Estrada.
<BR>Ing. Diseño y Automatización, 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éreo 3957, Santafé de Bogotá D.C., COLOMBIA.
<BR> </HTML>
--------------4D545CCF286D391657F8F67E--
- Raw text -