Why my simple program does not work in dosemu?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello:

Here is my simple program:


/************************************************************/
/* Pruebas para ver porque ftell se comporta raro en dosemu */

#include <stdio.h>

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@xxxxxxxxxxxx

<<attachment: PRUFTELL.EXE>>


[Index of Archives]     [Linux Console]     [Linux Audio]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Camping]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Samba]     [Linux Media]     [Fedora Users]

  Powered by Linux