Moves the current read-write file pointer by an offset expressed as a 32-bit integer.
Deprecated
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
PR_Seek64
.
#include <prio.h> PRInt32 PR_Seek( PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence);
The function has the following parameters:
fd
PRFileDesc
object.offset
whence
PRSeekWhence
that specifies how to interpret the offset
parameter in setting the file pointer associated with the fd parameter. The value for the whence
parameter can be one of the following:
PR_SEEK_SET
. Sets the file pointer to the value of the offset
parameter.PR_SEEK_CUR
. Sets the file pointer to its current location plus the value of the offset
parameter.PR_SEEK_END
. Sets the file pointer to the size of the file plus the value of the offset
parameter.The function returns one of the following values:
PR_GetError
.Here's an idiom for obtaining the current location of the file pointer for the file descriptor fd
:
PR_Seek(fd, 0, PR_SEEK_CUR)
If you need to move the file pointer by a large offset that's out of the range of a 32-bit integer, use PR_Seek64
. New code should use PR_Seek64
so that it can handle files larger than 2 GB.