Moves the current read-write file pointer by an offset expressed as a 32-bit integer.
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.
#include <prio.h> PRInt32 PR_Seek( PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence);
The function has the following parameters:
- A pointer to a
- A value, in bytes, used with the whence parameter to set the file pointer. A negative value causes seeking in the reverse direction.
- A value of type
PRSeekWhencethat specifies how to interpret the
offsetparameter in setting the file pointer associated with the fd parameter. The value for the
whenceparameter can be one of the following:
PR_SEEK_SET. Sets the file pointer to the value of the
PR_SEEK_CUR. Sets the file pointer to its current location plus the value of the
PR_SEEK_END. Sets the file pointer to the size of the file plus the value of the
The function returns one of the following values:
- If the function completes successfully, it returns the resulting file pointer location, measured in bytes from the beginning of the file.
- If the function fails, the file pointer remains unchanged and the function returns -1. The error code can then be retrieved with
Here's an idiom for obtaining the current location of the file pointer for the file descriptor
PR_Seek(fd, 0, PR_SEEK_CUR)