Reserved Identifiers
122
NetLinx Programming Language Reference Guide
Keywords & Run-Time Library Functions (Cont.)
FILE_GETDIR
This function returns the current working directory.
SLONG FILE_GETDIR (CHAR DirPath[ ])
Parameters:
•
DirPath
: Buffer to receive the current working directory.
Result:
• 0: Operation was successful
• -10: Size of
DirPath
buffer insufficient to hold directory path name
CHAR Buffer[256]Result = FILE_GETDIR (Buffer)
FILE_OPEN
This function opens a file for reading or writing.
SLONG FILE_OPEN (CHAR FilePath[ ], LONG IOFlag)
Parameters:
•
FilePath
: String containing the path to the file to be opened
•
IOFlag
:
1 Read
: The file is opened with
READ ONLY
status. The constant
FILE_READ_ONLY
is defined as a value of 1 for specifying this flag.
2 R/W New
: The file is opened with
READ WRITE
status. If the file currently
exists, its contents are erased. The constant
FILE_RW_NEW
is defined as a
value of 2 for specifying this flag.
3 R/W Append
: The file is opened with
READ WRITE
status. The current
contents of the file are preserved and the file pointer is set to point to the end
of the file. The constant
FILE_RW_APPEND
is defined as a value of 3 for
specifying this flag.
If the open operation is successful, this function returns a non-zero integer
value representing the handle to the file. This handle must be used in subse-
quent read, write, and close operations.
• >0: Handle to file (open was successful)
• -2: Invalid file path or name
• -3: Invalid value supplied for IOFlag
• -5: Disk I/O error
• -14: Maximum number of files are already open
If the file is opened successfully, it must be closed after all reading or writing is
completed, by calling
FILE_CLOSE
. If files are not closed, subsequent file open
operations may fail due to the limited number of file handles available.
// Open MYFILE.TXT for reading hFile =
FILE_OPEN('MYFILE.TXT', FILE_READ_ONLY)
Summary of Contents for NETLINX PROGRAMMING LANGUAGE
Page 15: ...Table of Contents xiii NetLinx Programming Language Reference Guide...
Page 16: ...xiv NetLinx Programming Language Reference Guide Table of Contents...
Page 18: ...Introduction 2 NetLinx Programming Language Reference Guide...
Page 76: ...Language Elements 60 NetLinx Programming Language Reference Guide...
Page 106: ...Combining Devices Levels and Channels 90 NetLinx Programming Language Reference Guide...
Page 112: ...Master To Master M2M 96 NetLinx Programming Language Reference Guide...
Page 182: ...Reserved Identifiers 166 NetLinx Programming Language Reference Guide...
Page 204: ...NetLinx UniCode Functions 188 NetLinx Programming Language Reference Guide...
Page 244: ...Appendix B Glossary 228 NetLinx Programming Language Reference Guide...
Page 245: ...Appendix B Glossary 229 NetLinx Programming Language Reference Guide...