Mail Archives: djgpp/2003/01/06/21:29:55
--------------Boundary-00=_ZPKBXSDEXFUEFHPS0N06
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
=09Hello.
Why doesn't the included program work correctly? It is supposed to deter=
mine=20
file sizes by dumb method, and does it under Linux. But when I tried it w=
ith=20
the latest DJGPP, both in DOSEmu and Windows 2000, it gave wrong numbers =
for=20
almost any files. I've discovered this problem when I tried to test the=20
abilities of DJGPP by entertaining with my old school project, a Huffman =
file=20
archiver. It worked fine under Linux, but cannot work at all under DJGPP=
=2E
=09--- Dmitry Rutsky
--------------Boundary-00=_ZPKBXSDEXFUEFHPS0N06
Content-Type: text/x-csrc;
charset="us-ascii";
name="size.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="size.c"
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv)
{
if (argc < 2)
printf ("USAGE: %s <filename>\n", argv [0]);
else
{
FILE *f;
f = fopen (argv [1], "r");
if (!f)
perror ("fopen");
else
{
int size = 0;
while (fgetc (f) != EOF)
size ++;
printf ("%d\n", size);
fclose (f);
}
}
}
--------------Boundary-00=_ZPKBXSDEXFUEFHPS0N06--
- Raw text -