Cfile::seek
Virtual Long Seek (long loff,uint nfrom);
throw (CFileException);
return value:
If the requested location is valid, seek returns the new byte offset from the beginning of the file. Otherwise the value is undefined and produces a cfileexception exception.
Parameters:
| Loff |
The number of bytes moved by the pointer. |
| Nfrom |
The mode of the pointer movement, which can be one of the following values:
| · |
Cfile::begin |
From the beginning of the file, move the pointer backwards loff bytes. |
| · |
Cfile::current |
From the current position, move the pointer backwards loff bytes. |
| · |
Cfile::end |
Move the pointer forward Loff bytes, starting at the end of the file. Note You must move to a file that exists, so loff should be negative. If positive, the end of the file is exceeded. |
|
Description
Repositions a pointer in a previously opened file. The Seek function allows us to randomly access the contents of a file, which is done by moving the pointer through a fixed amount, and the pointer movement can be absolute or relative. The file was not actually read when it was found.
When the file is opened, the file pointer is at offset 0, which is where the file begins.
Example:
Example for Cfile::seek
extern CFile CFile;
LONG loffset = 1000;
LONG lactual = CFile. Seek (Loffset, Cfile::begin);
Ext.: Cfile::seek