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 = System::READ_ONLY | System::OPEN_EXISTING
:  OSHandle FileHandle
);

Parameters

FileNamethe name of the file to be opened or created.
Flagsthe Flags can be one of the following:- System::CREATE_ALWAYS, System::CREATE_NEW, System::OPEN_ALWAYS, System::OPEN_EXISTING, System::TRUNCATE_EXISTING and or'ed with System::READ_ONLY if no write access is required.
FileHandlethe 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.errorString 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");

Since

TScript Version 1.0

Also See

System::ReadFile, System::SetFilePointer, System::WriteFile
Comments (0)Listen All
Characters left: 2500
 
Ekky Software Homepage Ekky Software Homepage ObjectDatabase++ TScript Ekky Software Homepage Ekky Software Homepage ObjectDatabase++ TScript