tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

pr_seek64.rst (1916B)


      1 PR_Seek64
      2 =========
      3 
      4 Moves the current read-write file pointer by an offset expressed as a
      5 64-bit integer.
      6 
      7 
      8 Syntax
      9 ------
     10 
     11 .. code::
     12 
     13   #include <prio.h>
     14 
     15   PRInt64 PR_Seek64(
     16     PRFileDesc *fd,
     17     PRInt64 offset,
     18     PRSeekWhence whence);
     19 
     20 
     21 Parameters
     22 ~~~~~~~~~~
     23 
     24 The function has the following parameters:
     25 
     26 ``fd``
     27   A pointer to a :ref:`PRFileDesc` object.
     28 ``offset``
     29   A value, in bytes, used with the whence parameter to set the file
     30   pointer. A negative value causes seeking in the reverse direction.
     31 ``whence``
     32   A value of type :ref:`PRSeekWhence` that specifies how to interpret the
     33   ``offset`` parameter in setting the file pointer associated with the
     34   fd parameter. The value for the ``whence`` parameter can be one of
     35   the following:
     36 
     37    - :ref:`PR_SEEK_SET`. Sets the file pointer to the value of the
     38      ``offset`` parameter.
     39    - :ref:`PR_SEEK_CUR`. Sets the file pointer to its current location
     40      plus the value of the ``offset`` parameter.
     41    - :ref:`PR_SEEK_END`. Sets the file pointer to the size of the file
     42      plus the value of the ``offset`` parameter.
     43 
     44 
     45 Returns
     46 ~~~~~~~
     47 
     48 The function returns one of the following values:
     49 
     50 -  If the function completes successfully, it returns the resulting file
     51   pointer location, measured in bytes from the beginning of the file.
     52 -  If the function fails, the file pointer remains unchanged and the
     53   function returns -1. The error code can then be retrieved with
     54   :ref:`PR_GetError`.
     55 
     56 
     57 Description
     58 -----------
     59 
     60 This is the idiom for obtaining the current location (expressed as a
     61 64-bit integer) of the file pointer for the file descriptor ``fd``:
     62 
     63 ``PR_Seek64(fd, 0, PR_SEEK_CUR)``
     64 
     65 If the operating system can handle only a 32-bit file offset,
     66 :ref:`PR_Seek64` may fail with the error code ``PR_FILE_TOO_BIG_ERROR`` if
     67 the ``offset`` parameter is out of the range of a 32-bit integer.
     68 
     69 
     70 See Also
     71 --------
     72 
     73 :ref:`PR_Seek`