About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/lseek.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 lseek Context: slangrtl

Synopsis

Reposition a file descriptor's file pointer

Syntax

Long_Type lseek (FD_Type fd, Long_Type ofs, int mode)

Description

The lseek function repositions the file pointer associated with the open file descriptor fp to offset ofs according to the mode parameter. Specifically, mode must be one of the values:

     SEEK_SET   Set the offset to ofs
     SEEK_CUR   Add ofs to the current offset
     SEEK_END   Add ofs to the current file size

Upon error, lseek returns -1 and sets errno. If successful, it returns the new filepointer offset.

Not all file descriptors are capable of supporting the seek operation, e.g., a descriptor associated with a pipe.

By using SEEK_END with a positive value of the ofs parameter, it is possible to position the file pointer beyond the current size of the file.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.