Exemple #1
0
/** @memo   Moves the file pointer to the offset from the origin.

    @doc    Move the file pointer to the offset in the file 
    relative to the origin.
    
    @return 0 on success, -1 otherwise.
 */
long rtp_stdio_fseek (
  void * rtpfile,                       /** Handle of file to move its pointer. */
  long offset,                          /** The offset to move the pointer. */
  int origin                            /** The location that the offset is relative to:<br>
	<pre>	
|		0   To seek from the beginning of the file.
|		1   To seek from the current file pointer position.
|		2   To seek from the end of the file.
	</pre> */
  )
{
    if( !rtpfile || (((RTP_STDIO_FILE *)rtpfile)->verify != RTP_FILE_VERIFICATION_VALUE) )
    {
        /* --------------------------------------- */
        /*  Application passed an RTP_HANDLE       */
        /*  instead of an RTP_STDIO_FILE. Should   */
		/*  use low level rtp_file_read().         */
        /* --------------------------------------- */
        return (-1);
    }

    if (rtp_file_lseek (((RTP_STDIO_FILE *)rtpfile)->handle, offset, origin) < 0)
    {
        return (-1);
    }
    
    /* --------------------------------------- */
    /*  Clear end of file indicator if seek    */
    /*  is successful.                         */
    /* --------------------------------------- */
    ((RTP_STDIO_FILE *)rtpfile)->eofBool = 0;
    
    return (0);
}
Exemple #2
0
long rtplatform_lseek(int fd, long offset, int origin)
{
    long rv;

    rv = rtp_file_lseek ((RTP_HANDLE) fd, offset, origin);
    if (rv < 0)
    {
        return -1;
    }
    return rv;

}