From: fox AT cat DOT nyu DOT edu (David Fox) Subject: Re: lseek past EOF doesn't append zeros under Windows 95 20 Jun 1998 19:36:23 -0700 Message-ID: References: To: gnu-win32 AT cygnus DOT com Cc: beshers AT cs DOT columbia DOT edu David Fox 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".