System.CreateFile
System.CreateFile create or opens a file resource for reading or
writing. This static method will check to see is the currently executing script
has the appropriate permissions to the desired file before allowing the
underline function to be called. This will block access to files even if the
current process is executing as a user who has permissions under Windows native
security protocols.
public System.CreateFile(
WString FileName,
Integer Flags = TVariable.None
: OSHandle FileHandle
);
Parameters
| FileName |
The name of the file to be opened or created. |
| Flags |
The Flags can be one of the following:- System.CREATE_ALWAYS,
System.CREATE_NEW, System.OPEN_ALWAYS, System.OPEN_EXISTING,
System.TRUNCATE_EXISTING and ored with System.READ_ONLY if no write access is
required. |
| FileHandle |
The returned file handle if the static method does not return an error. |
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(L"MyFile.txt",System.OPEN_EXISTING|System.READ_ONLY:fileHandle);
System.ReadFile(fileHandle:fileBuffer);
System.MessageBox(fileBuffer.ToString(),L"File Contents of MyFile.txt");
Also See
System.ReadFile, System.WriteFile
Copyright © 2008, Ekky Software Pty Ltd.