Mail Archives: djgpp/1993/04/30/04:57:39
> I've been investigating the trucate bug I posted on earlier,
> and after looking through a description of the DOS system calls,
> came to the conclusion that the only way you can truncate a file
> is using FCB functions. Can anyone confirm that ?
Uh, well, yes I can confirm that your information is incorrect. I
_know_ this is gonna sound weird, BUT ...
void trunc(int fd, long where)
{
fseek(fd,where,SEEK_SET);
write(fd,(void*)0,0);
}
this little trick can make for interesting error conditions when
otherwise healthy programs decide to write zero bytes to a file
for some stupid reason :-)
--
J. Alan Eldridge (alane AT wozzle DOT linet DOT org)
(also on Fidonet: 1:272/38.473)
- Raw text -