Maptitude GISDK Help

OpenFile()

Summary

Opens a text or binary file on disk.

 

Syntax

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

 

Returns

A file handle.

 

Example

fptr = OpenFile("report.txt", "w")

WriteLine(fptr, "This is the first line of the report")

CloseFile(fptr)

 

Error Codes

Error Type

Meaning

Error

Invalid access mode

NotFound

File does not exist or could not be opened

 

See Also

Function

Summary

CloseFile()

Closes a file

 

 

©2025 Caliper Corporation www.caliper.com