summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fseek.3
diff options
context:
space:
mode:
authordt <dt@FreeBSD.org>1999-02-08 21:32:38 +0000
committerdt <dt@FreeBSD.org>1999-02-08 21:32:38 +0000
commitdd5f24e20cdd683adbb5885bb01814ac81fbc90b (patch)
tree2f7f0b89a7c12e8dce152773c267d5fe10f78eb6 /lib/libc/stdio/fseek.3
parentaf242fbed135e989cc0ff0985a4ebdad783ef2eb (diff)
downloadFreeBSD-src-dd5f24e20cdd683adbb5885bb01814ac81fbc90b.zip
FreeBSD-src-dd5f24e20cdd683adbb5885bb01814ac81fbc90b.tar.gz
Added functions fseeko() and ftello() (from susv2).
Fixed fgetpos() and fsetpos() for offsets > 2GB. PR: 8637 Submitted by: Dan Nelson <dnelson@emsphone.com> (adjusted by me a little)
Diffstat (limited to 'lib/libc/stdio/fseek.3')
-rw-r--r--lib/libc/stdio/fseek.350
1 files changed, 45 insertions, 5 deletions
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 .
OpenPOWER on IntegriCloud