System::ReadFile

System::ReadFile will read in the contents of a file previously opened by System::CreateFile.

public System::ReadFile(
   OSHandle FileHandle,
   Integer Length = TVariable::None,
   Integer Position = TVariable::None
:  BString FileContents
);

Parameters

FileHandleFrom previous call to System::CreateFile.
Lengthwill read the entire file to end if default parameter is passed.
Positionwill read from the current file position if default parameter is passed.
FileContentsa buffer containing the contents of the file successfully read.

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

Example Use
  • TScript
main(){
   variable fileHandle, fileBuffer;
   System::CreateFile(u"MyFile.txt",
      System::OPEN_EXISTING|System::READ_ONLY:fileHandle);
   System::ReadFile(fileHandle:fileBuffer);
   System::MessageBox(fileBuffer.ToString(),
      u"File Contents of MyFile.txt");
}

Since

TScript Version 1.0

Also See

System::CreateFile, System::SetFilePointer, 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