Difference between revisions of "FILE OPEN"

From Macros Wiki
Jump to: navigation, search
Line 1: Line 1:
 
[[:Category:External_File_Handling|{{Up}}]]
 
[[:Category:External_File_Handling|{{Up}}]]
  
{{Command|syntax=FILE_OPEN <filename>, <file Number>, [<type>]
+
{{Command|syntax=FILE_OPEN <filename>, <file Number>, [<action>]
 
|description=Open a text file.
 
|description=Open a text file.
  
 
|param1=<filename>|param1_desc={{filename}}
 
|param1=<filename>|param1_desc={{filename}}
 
|param2=<file Number>|param2_desc={{file Number}}
 
|param2=<file Number>|param2_desc={{file Number}}
|param3=[<type>]|param3_desc={{type}}
+
|param3=[<action>]|param3_desc=The file action may be READ, WRITE or APPEND.<br>
 +
:A file opened for READ must already exist.
 +
:A file opened for WRITE will be created, if it does not exist, or overwritten (without warning) if it already exists.
 +
:A file opened for APPEND will be created, if it does not exist. If it does exist, it is opened and the file pointer is moved to the end of file so that output is appended to the end of the file.
 
}}
 
}}
  

Revision as of 19:43, 18 August 2010

Up

Command

FILE_OPEN <filename>, <file Number>, [<action>]


Open a text file.

Parameters

<filename>
Filename as either text in double quotes, or a text variable.
If the filename does not contain full path information, then the file will be opened in the same folder as the macro.
<file Number>
File number, 1 to 10. You may have up to 10 files open at the same time.
[<action>]
The file action may be READ, WRITE or APPEND.
A file opened for READ must already exist.
A file opened for WRITE will be created, if it does not exist, or overwritten (without warning) if it already exists.
A file opened for APPEND will be created, if it does not exist. If it does exist, it is opened and the file pointer is moved to the end of file so that output is appended to the end of the file.

Example

FILE_OPEN
For an example macro see Get_Op_Tool_Path Global_Local Print_Geo_Data_To_File