Reserved Identifiers
123
NetLinx Programming Language Reference Guide
Keywords & Run-Time Library Functions (Cont.)
FILE_READ This function reads a block of data from the specified file.
SLONG FILE_READ (LONG hFile, CHAR Buffer[ ], LONG BufLen)
Parameters:
• hFile: Handle to the file returned by File_Open
• Buffer: Buffer to hold the data to be read
• BufLen: Maximum number of bytes to read
Result:
• >0: The number of bytes actually read
• -1: Invalid file handle
• -5: Disk I/O error
• -6: Invalid parameter
• -9: End-of-file reached
This function reads (from the current location of the file pointer) the number of
bytes specified by BufLen (or fewer bytes if the end of file is reached). The
bytes are read from the file identified by hFile and are stored in Buffer. The
file pointer will automatically be advanced the correct number of bytes so the
next read operation continues where the last operation left off.
CHAR Buffer[1024]nBytes = FILE_READ (hFile, Buffer, 1024)
FILE_READ_LINE This function reads a line of data from the specified file.
SLONG FILE_READ_LINE (LONG hFile, CHAR Buffer[ ], LONG
BufLen)
Parameters:
• hFile: Handle to the file returned by File_Open
• Buffer: Buffer to hold the data to be read
• BufLen: Maximum number of bytes to read
Result:
• =0:The number of bytes actually read
• -1: Invalid file handle
• -5: Disk I/O error
• -6: Invalid parameter (buffer length must be greater than zero)
• -9: End-of-file reached
This function reads from the current location of the file pointer up to the next
carriage return or to the end-of-file (EOF), whichever comes first. A complete
line will not be read if the buffer length is exceeded before a carriage return (or
EOF) is encountered. The bytes are read from the file identified by hFile and
are stored in Buffer. The <CR> or <CR><LF> pair will not be stored in Buffer.
If a complete line is read, the file pointer is advanced to the next character in the
file after the <CR> or <CR><LF> pair or to the EOF if the last line was read.
CHAR Buffer[80]nBytes = FILE_READ_LINE (hFile, Buffer,
80)