Home Texas Server Home Page

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

FileHandle From previous call to System.CreateFile.
Length Will read the entire file to end if default parameter is passed.
Position Will read from the current file position if default parameter is passed.
FileContents A 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.errorMessage will have a detailed description of the error

Remarks

Example Use

variable fileHandle, fileBuffer;
System.CreateFile("MyFile.txt",System.OPEN_EXISTING|System.READ_ONLY:fileHandle);
System.ReadFile(fileHandle:fileBuffer);
System.MessageBox(fileBuffer.ToString(),"File Contents of MyFile.txt");

Also See

System.CreateFile, System.WriteFile

Copyright © 2008, Ekky Software Pty Ltd.