ReadFile()
Syntax
Result = ReadFile(#File, Filename$)Description
Open an existing file for read-only operations.
If #PB_Any is used as '#File' parameter, the new file number will be returned as 'Result'.
If 'Result' is not 0, the file has been effectively opened, else the file may not be opened. The result must be always tested, since performing operations on a non-opened file will cause a severe crash.
If the #File was already used, the previous file will be closed automatically.Example:
If ReadFile(0, "Text.txt") ; if the file could be read, we continue... While Eof(0) = 0 ; loop as long the 'end of file' isn't reached Debug ReadString(0) ; display line by line in the debug window Wend CloseFile(0) ; close the previously opened file Else MessageRequester("Information","Couldn't open the file!") EndIf
Supported OS
All