From: Alejandro Bonet Subject: Why my simple program does not work in dosemu? Date: Sat, 2 Dec 2006 19:36:23 +0000 (UTC) Message-ID: <200612021936.kB2JZvJw013901@zeus1.kernel.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_000679" Return-path: Date: Sat, 02 Dic 2006 18:53 GMT Sender: linux-msdos-owner@vger.kernel.org List-Id: To: linux-msdos@vger.kernel.org Este es un mensaje multipart en formato MIME. ------=_NextPart_000_000679 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello: Here is my simple program: /************************************************************/ /* Pruebas para ver porque ftell se comporta raro en dosemu */ #include void PruebaArchivo(char *fnom) { FILE *fich;char ch,buf[100]; fich=fopen(fnom,"r+b"); if (fich==NULL) { printf("Archivo %s no encontrado\n",fnom);return; } buf[0]=0; for (;;) { printf("%ld: %s\n",ftell(fich),buf); ch=getc(stdin); if (ch=='a') { fread(buf,1,10,fich);buf[11]=0; } else if (ch=='t') fseek(fich,ftell(fich)-1L,SEEK_SET); else if (ch=='x') break; } fclose(fich); } void main(int argc,char *argv[]) { if (argc<2) printf("Sintaxis: pruftell file\n"); PruebaArchivo(argv[1]); } /************************************************************/ I have compiled it over msdos via Borland Turbo C 2.0, and also in GNU/linux via gcc. In both systems the results are identical. But if i run the msdos version (attached as pruftell.exe) in dosemu, the behavior is absurd... Why? It seems as ftell returns the file buffer reads instead function fread reads. Thanks in advance Alejandro Bonet Babel Informatica SL alex@winbabel.org ------=_NextPart_000_000679--