Phantom Documentation

[Help Home] [Phantom Home]
Example Code

The following code demonstrates the use of the file operation functions

Example Code

file hFile;

string sName = "test.txt";

string sVar;
bool bSuccess = true;

# Open the File
hFile = OpenFile(sName, "w");

# Write some messages to the file
WriteFile(hFile, "The Phantom Strikes Again.");
WriteFile(hFile, "And Again...");

# Close the file
CloseFile(hFile);

# Re-open the file for writing
OpenFile(hFile, sName, "r");

# Read and display the whole file
while(bSuccess == true)
{
  bSuccess = ReadFile(hFile, sVar);
  disp(sVar);
}

# Close the file
CloseFile(hFile);

 


Copyright 2000-2011 Phantom Automated Solutions