Reserved Identifiers
124
NetLinx Programming Language Reference Guide
Keywords & Run-Time Library Functions (Cont.)
FILE_REMOVEDIR This function removes the specified directory path, but it will not remove files or
directories below it.
CAUTION: If a subdirectory or files exist in the directory that you are trying to
remove, the operation will fail and will return a -5 (disk IO error).
SLONG FILE_REMOVEDIR (CHAR DirPath[ ])
Parameters:
• DirPath: String containing the directory path to remove.
Result:
• 0: Operation was successful
• -4: Invalid directory path
• -5: Disk I/O error
If you have \CDLIST\TEMP, and there are no files in either directory, the follow-
ing code will fail to delete the \CDLIST directory.
FILE_REMOVEDIR('\CDLIST')
The following code will delete the \CDLIST directory.
FILE_REMOVEDIR('\CDLIST\TEMP')FILE_REMOVEDIR('\CDLIST')
FILE_RENAME This function renames the specified file.
SLONG FILE_RENAME (CHAR FilePath[ ], CHAR NewFileName[ ])
Parameters:
• FilePath: Path name of the file to rename.
• NewFileName: New file name. This name must not contain a directory path.
Result:
• 0: Operation was successful
• -2: Invalid file name
• -5: Disk I/O error
• -8: File name exists
// renames \CDLIST\OLDFILE.TXT to
\CDLIST\NEWFILE.TXTResult = FILE_RENAME
('\CDLIST\OLDFILE.TXT', 'NEWFILE.TXT')
FILE_SEEK This function sets the file pointer to the specified position.
SLONG FILE_SEEK (LONG hFile, LONG Pos)
Parameters:
• hFile: Handle to the file returned by File_Open.
• Pos: The byte position to set the file pointer (0 = beginning of file, -1 = end of
file).
Result:
• >=0: Operation was successful and the result is the current file pointer value
• -1: Invalid file handle
• -5: Disk I/O error
• -6: Invalid parameter; pos points beyond the end-of-file (position is set to the
end-of-file)
After FILE_SEEK is successfully called, subsequent read or write operations
begin at the byte number specified by Pos.
// Sets the file pointer to byte number 1000. Subsequent
// read or write operations will begin at byte number
1000.Result = FILE_SEEK (hFile, 1000)