Date: Mon, 24 Nov 1997 13:47:55 +0200 (IST) From: Eli Zaretskii To: DJ Delorie cc: djgpp-workers AT delorie DOT com Subject: Docs changes for lseek and fseek Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk Somebody asked for the subtle points of fseek to be documented. Here: *** src/libc/ansi/stdio/fseek.t~0 Mon Jul 10 05:39:44 1995 --- src/libc/ansi/stdio/fseek.txh Sat Nov 22 19:31:16 1997 *************** *** 34,40 **** been opened as a text file. Although this restriction is not enforced, beware that there is not a one-to-one correspondence between file characters and text characters under MS-DOS, so some @code{fseek} ! operations may not do exactly what you expect. @subheading Return Value --- 34,45 ---- been opened as a text file. Although this restriction is not enforced, beware that there is not a one-to-one correspondence between file characters and text characters under MS-DOS, so some @code{fseek} ! operations may not do exactly what you expect. ! ! Also, since @code{lseek} under DOS does not return an error indication ! when you try to move the file pointer before the beginning of the file, ! neither will @code{fseek}. Portable programs should call @code{ftell} ! after @code{fseek} to get the actual position of the file pointer. @subheading Return Value *** src/libc/posix/unistd/lseek.t~0 Mon Jul 10 05:40:48 1995 --- src/libc/posix/unistd/lseek.txh Sat Nov 22 19:26:34 1997 *************** *** 29,34 **** --- 29,39 ---- @end table + Note that DOS does not mind if you seek before the beginning of the + file, like seeking from the end of the file by more than the file's + size. Therefore, @code{lseek} will not return with an error in such + cases either. + @subheading Return Value The new offset is returned.