Einzelnen Beitrag anzeigen
Alt 10.10.2012, 02:08   #79
leecher
Moderator
C_LSEEK

E r g e b n i s / R e s u l t

The C_LSEEK function moves a file pointer to the specified location.

B e s c h r e i b u n g / D e s c r i p t i o n

The C_LSEEK function moves the file pointer associated with the file descriptor fd to a new location that is offset bytes from origin. The next operation on the file occurs at the new location.

S y n t a x

Code:
res = call ('C_LSEEK' , fd, offset, origin)
P a r a m e t e r

fd - The file descriptor you obtained from C_OPEN
offset - Number of bytes from origin
origin - Initial position

origin can be one of the following values:
0 - Seek relative to begining of file
1 - Seek relative to current file position
2 - Seek relative to end of file

R e t u r n s

C_LSEEK returns the offset, in bytes, of the new position from the beginning of the file.

B e i s p i e l / E x a m p l e

Code:
attach 'FILE0'
attach 'FILE1'
fd = CALL ("C_OPEN", "FILE.TXT", "r")
PUT CALL ("C_LSEEK", fd, 0, 2) ! Seeks to end of file, therefore returns filesize
b = CALL("C_CLOSE", fd)
detach 'FILE0'
detach 'FILE1'
leecher ist offline   Mit Zitat antworten