Mail Archives: djgpp-workers/1999/04/09/14:37:11
DJ Delorie wrote:
> > DJGPP doesn't maintain a consistent view of the file.
>
> Like I said, it's not DJGPP it's DOS. Turbo-C should show the same
> behavior (can someone verify this?) with your example.
Actually, this test program (which could someone please spot-check for
me? :) prints 1 on MS-DOS 5 and Windows 98 DOS box, whether compiled
with Turbo C (TC++ 1.01) or DJGPP. Interesting.
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
int main(void)
{
char d, c = '1';
int a, b;
a = open ("foo", O_CREAT¦O_WRONLY, 0644);
write(a, &c, 1);
b = open ("foo", O_RDONLY);
printf("Read %d bytes\n", read (b, &d, 1));
printf("d=%d ('%c')\n", d, d);
return 0;
}
Using _read and _write changes nothing.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -