Mail Archives: cygwin/1998/06/20/19:36:23
David Fox <fox AT cat DOT nyu DOT edu> writes:
> Run this with the argument 100 and you will get a two hundred byte
> file filled with garbage. Under Unix or cygwin32_nt the first hundred
> bytes will be zero. Any advice?
Here is a wrapper for lseek that works around this problem:
off_t zlseek(int fildes, off_t offset, int whence)
{
off_t end = lseek(fildes, 0L, SEEK_END);
if (end < offset) {
char buf[offset-end];
memset(buf, 0, offset - end);
write(fildes, buf, offset - end);
}
return lseek(fildes, offset, whence);
}
--
David Fox http://www.cat.nyu.edu/fox xoF divaD
NYU Media Research Lab fox AT cat DOT nyu DOT edu baL hcraeseR aideM UYN
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -