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 identifier will be returned as 'Result'.
If 'Result' is not 0, the file is effectively opened, else the file can't be opened. It must be always tested, as performing operations on a non opened file will cause severe crashs.
If the #File was already used, the previous file is automatically closed.
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() ; 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