
Function: read
The read
function reads the entire content of a file into a string variable. It takes the open file ID obtained from the "open" function as a parameter. If you want to read a file line by line, consider using the readline
function. After the content has been read, you must close the file using the close
command.
Parameters:
Parameter Name | Type | Description |
---|---|---|
FileID | int | File ID obtained from the "open" function. |
Return Value:
Type TEXT: The content of the file.
Example:
int x = open("myfile.txt", "r");
string content = read(x);
close(x);
See Also:
- open file
- close file
- write to file