Mail Archives: djgpp-workers/1997/11/24/06:48:22
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.
- Raw text -