System::SetFilePointer

System::SetFilePointer will change the current file position of a file previously opened by System::CreateFile.

System::SetFilePointer(
   OSHandle FileHandle,
   Integer Position = 0,
   Integer Method = System::FILE_BEGIN
:  Integer Position
);

Parameters

FileHandleFrom previous call to System::CreateFile.
Positionthe position that the file wants to be moved to.
Methodany one of:- System::FILE_BEGIN; System::FILE_CURRENT; xor System::FILE_END.
Positionresulting position after the method has completed.

Return Values

The error.errorCode value will be set to the underlining windows error message code and the error.errorString will have a detailed description of the error.

Remarks

  • System::SetFilePointer(FileHandle) will move to the begining of the file.
  • System::SetFilePointer(FileHandle,0,System::FILE_CURRENT:currentPosition) will return the current location of the file.
Example Use
  • TScript
main(){
   variable fileHandle, fileBuffer;
   System::CreateFile(u"MyFile.txt",
      System::OPEN_EXISTING|System::READ_ONLY:fileHandle);
   System::SetFilePointer(fileHandle,50);
   System::ReadFile(fileHandle:fileBuffer);
   System::MessageBox(fileBuffer.ToString(),
      u"File Contents of MyFile.txt after 50 bytes");
}

Since

TScript Version 1.3

Also See

System::CreateFile, System::ReadFile, System::WriteFile
Listen All
Comments (0)
Characters left: 2500
 
Ekky Software Homepage T-Accounts Online ObjectDatabase++ TScript Ekky Software Homepage T-Accounts Onlinee ObjectDatabase++ TScript