File_Close; File_Copy - AMX NETLINX PROGRAMMING LANGUAGE Manual

Programming language
Table of Contents

Advertisement

Reserved Identifiers
Keywords & Run-Time Library Functions (Cont.)

FILE_CLOSE

FILE_COPY

120
This function closes a file opened with FILE_OPEN. This function should be
called when all reading or writing to the file is completed.
SLONG File_Close (LONG hFile)
Parameters:
• hFile: Handle to the file returned by File_Open.
Result:
• 0: Operation was successful
• -1: Invalid file handle
• -5: Disk I/O error
• -7: File already closed
There is a limit to the number of file handles available from the system. If files
are not closed, it may not be possible to open a file.
Result = File_Close(hFile)
This function copies the specified file.
SLONG File_Copy(CHAR SrcFilePath[ ], CHAR DstFilePath[ ])
Parameters:
• SrcFilePath: Path name of the file to copy (source).
• DstFilePath: Path name of the copied file (destination).
Result:
• 0: Operation was successful
• -2: Invalid file name
• -5: Disk I/O error
• -11: Disk full
If either path name fails to specify a directory, the current directory is assumed.
The current directory is either the top-level directory or the subdirectory speci-
fied in the last call to File_SetDir.
// copy OLDFILE.TXT in the current directory to
NEWFILE.TXT
Result = File_Copy('OLDFILE.TXT', 'NEWFILE.TXT')
CHAR
Buffer[1024]
SLONG NumFiles = 1
LONG Entry = 1
WHILE (NumFiles > 0)
{
NumFiles = FILE_DIR ('AAA:', Buffer, Entry)
Entry = Entry + 1
// add code to display contents of Buffer
}
NetLinx Programming Language Reference Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Netlinx studio 2

Table of Contents