From dd5f24e20cdd683adbb5885bb01814ac81fbc90b Mon Sep 17 00:00:00 2001 From: dt Date: Mon, 8 Feb 1999 21:32:38 +0000 Subject: Added functions fseeko() and ftello() (from susv2). Fixed fgetpos() and fsetpos() for offsets > 2GB. PR: 8637 Submitted by: Dan Nelson (adjusted by me a little) --- lib/libc/stdio/fseek.3 | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) (limited to 'lib/libc/stdio/fseek.3') diff --git a/lib/libc/stdio/fseek.3 b/lib/libc/stdio/fseek.3 index 5dd79e9..064130a 100644 --- a/lib/libc/stdio/fseek.3 +++ b/lib/libc/stdio/fseek.3 @@ -41,8 +41,10 @@ .Sh NAME .Nm fgetpos , .Nm fseek , +.Nm fseeko , .Nm fsetpos , .Nm ftell , +.Nm ftello , .Nm rewind .Nd reposition a stream .Sh SYNOPSIS @@ -57,6 +59,10 @@ .Fn fgetpos "FILE *stream" "fpos_t *pos" .Ft int .Fn fsetpos "FILE *stream" "const fpos_t *pos" +.Ft int +.Fn fseeko "FILE *stream" "off_t offset" "int whence" +.Ft off_t +.Fn ftello "FILE *stream" .Sh DESCRIPTION The .Fn fseek @@ -106,6 +112,22 @@ except that the error indicator for the stream is also cleared .Xr clearerr 3 ) . .Pp The +.Fn fseeko +function is identical to +.Fn fseek , +but take an +.Fa off_t +argument +instead of a +.Fa long . +Likewise, the +.Fn ftello +function is identical to +.Fn ftell , +but returns +.Fa off_t . +.Pp +The .Fn fgetpos and .Fn fsetpos @@ -115,8 +137,8 @@ are alternate interfaces equivalent to and .Fn fseek (with whence set to -.Dv SEEK_SET -), setting and storing the current value of +.Dv SEEK_SET ) , +setting and storing the current value of the file offset into or from the object referenced by .Fa pos . On some @@ -133,10 +155,14 @@ returns no value. Upon successful completion, .Fn fgetpos , .Fn fseek , +.Fn fseeko , +and .Fn fsetpos return 0, and .Fn ftell +and +.Fn ftello returns the current offset. Otherwise, \-1 is returned and the global variable errno is set to indicate the error. @@ -157,14 +183,21 @@ was not .Dv SEEK_END , or .Dv SEEK_CUR . +.It Bq Er EOVERFLOW +For +.Fn ftell , +the resulting file offset would be a value which +cannot be represented correctly in an object of type long. .El .Pp -The function +The functions .Fn fgetpos , .Fn fseek , +.Fn fseeko , .Fn fsetpos , -and -.Fn ftell +.Fn ftell , +and +.Fn ftello may also fail and set .Va errno for any of the errors specified for the routines @@ -186,3 +219,10 @@ and functions conform to .St -ansiC . +.Pp +The +.Fn fseeko +and +.Fn ftello +functions conform to +.St -susv2 . -- cgit v1.1