Mono Class Library: Mono.Unix.Native.Stdlib Overview | Members

Mono.Unix.Native.Stdlib.fgetpos Method

Retrieve the current file position of a FILE stream. [Edit]

public static int fgetpos (IntPtr stream, FilePosition pos)

Parameters

stream
FILE stream to retreive the current file position for. [Edit]
pos
Where to store the current file position. [Edit]

Returns

Returns 0 if successful; otherwise -1 is returned and Stdlib.GetLastError indicates the error.

Usage

The following errors are specified:

ErrorDetails
Errno.EBADFThe stream argument is not not a seekable stream
Errno.EINVALThe whence argument is invalid or the resulting file-position indicator would be set to a negative value.
Errno.EOVERFLOWThe resulting file offset would be a value which cannot be represented correctly in an object of type stem.Int64 for Stdlib.fseek() and Stdlib.ftell().
Errno.ESPIPEThe file descriptor underlying stream is associated with a pipe or FIFO or file-position indicator value is unspecified (see Stdlib.ungetc(3)).

fgetpos may also fail for any of the error specified for the routines Stdlib.fflush(3), Syscall.fstat(2), Syscall.lseek(2), and Stdlib.malloc(3)

[Edit]

Remarks

The fgetpos() is an alternate interfaces for retrieving the current position in the file, similar to Stdlib.ftell(), except that the current position is stored in an opaque object of type Mono.Unix.Native.FilePosition pointed to by pos. This provides a portable way to seek to offsets larger than those that can be represented by a long int. They may also store additional state information in the Mono.Unix.Native.FilePosition object to facilitate seeking within files containing multibyte characters with state-dependent encodings.

Note: The value of pos is modified by this operation.
[Edit]

Requirements

Namespace: Mono.Unix.Native
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0