This module enables you to perform IO operations on files such as reading existing files and creating new ones.
File IO Module API
Syntax |
Parameters |
Return Value |
Description |
OpenFile(fileName AS STRING) AS INTEGER |
fileName: specifies the name of the file to be opened. |
Handle (integer) of the opened file. fileID will be zero if the file could not be opened. |
Opens an existing file for IO operations or creates a new file in case it does not exist. |
CreateFile(fileName AS STRING) AS INTEGER |
fileName: specifies the name of the file to be created. |
Handle (integer) of the created file. fileID will be zero if the file could not be created. |
Creates a new file for writing operations. |
ReadFile(fileName AS STRING) AS INTEGER |
fileName: specifies the name of the file to be opened for reading. |
Handle (integer) of the opened file. fileID will be zero if the file could not be opened for reading. |
Opens an existing file for reading operations. |
CloseFile(fileID AS INTEGER) |
fileID: specifies the handle of a previously opened/created file. |
none |
Closes a file and frees its resources. |
EndOfFile(fileID AS INTEGER) AS INTEGER |
fileID: specifies the handle of a previously opened/created file. |
true if the end of the file (EOF) has been reached. False otherwise. |
Checks whether the end of a previously opened file has been reached (for reading purposes). |
FileLength(fileID AS INTEGER) AS INTEGER |
fileID: specifies the handle of a previously opened/created file. |
Integer value specifying the length of file (LOF) in bytes. |
Returns the length of file (LOF) in bytes of a previously opened file. |
FileSeek(fileID AS INTEGER, position AS INTEGER) AS VOID |
fileID: specifies the handle of a previously opened/created file.
position: specifies a new position for IO operations within the file (absolute position). |
none |
Changes the position for IO operations of a previously opened file. |
WriteString(fileID AS INTEGER, text AS STRING) AS VOID |
fileID: specifies the handle of a previously opened/created file.
text: specifies a string to be written to the file. |
none |
Writes a string terminated by a new line to a previously opened/created file. |
WriteInteger(fileID AS INTEGER, value AS integer) AS VOID |
fileID: specifies the handle of a previously opened/created file.
value: specifies an integer value to be written to the file. |
none |
Writes an integer value to a previously opened/created file. |
WriteFloat(fileID AS INTEGER, value AS float) AS VOID |
fileID: specifies the handle of a previously opened/created file.
value: specifies a float value to be written to the file. |
none |
Writes a float value to a previously opened/created file. |
ReadString(fileID AS INTEGER) AS STRING |
fileID: specifies the handle of a previously opened/created file. |
String specifying a new line read from the file. |
Reads a new line from a previously opened file. |
ReadInteger(fileID AS INTEGER) AS INTEGER |
fileID: specifies the handle of a previously opened/created file. |
Integer value read from the file. |
Reads an integer value from a previously opened file. |
ReadFloat(fileID AS INTEGER) AS FLOAT |
fileID: specifies the handle of a previously opened/created file. |
Float value read from the file. |
Reads a float value from a previously opened file. |
Copyright © 2020 solicus. All Rights Reserved. Last Update: 2020-5-25.