Maptitude GISDK Help |
Opens a text or binary file on disk.
file = OpenFile(string file_name, string mode)
Argument |
Contents |
file_name |
The full path and name of the file to be opened |
mode |
The mode in which the file is opened, as shown below |
Mode |
Meaning |
r |
Open text file for reading |
w |
Create text file for writing, or truncate to zero length |
a |
Append: open text file or create for writing at end of file |
rb |
Open binary file for reading |
wb |
Create binary file for writing, or truncate to zero length |
ab |
Append: open binary file for writing at end of file |
r+ |
Open text file for update (reading and/or writing) |
w+ |
Create text file for update, or truncate to zero length |
a+ |
Append: open text file or create for update, writing at end of file |
rb+ |
Open binary file for update (reading and/or writing) |
wb+ |
Create binary file for update, or truncate to zero length |
ab+ |
Append: open binary file or create for update, writing at end of file |
A file handle.
fptr = OpenFile("report.txt", "w")
WriteLine(fptr, "This is the first line of the report")
CloseFile(fptr)
Error Type |
Meaning |
Error |
Invalid access mode |
NotFound |
File does not exist or could not be opened |
Function |
Summary |
Closes a file |
©2025 Caliper Corporation | www.caliper.com |