Core Function FileRead
From Sputnik Wiki
FileRead( <file>, <expression> )
Contents |
Description
Read a number of bytes from a previously opened text file starting from current File Steam pointer location and return them as a string.
Parameters
file
A variable containing the File handle.
expression
Optional; Number of bytes to read.
If this param is not provided it will read to the end of the file.
Return Value
Success: Returns a string
Failure: Returns null if error occurs.
Remarks
N/A
Example
$File = FileOpen("MyFile.txt", "r"); If(isVarObj($File, "file")) { $Str = FileRead($File); println( "String is: " . $Str ); FileClose( $File ); }
You could also tell it where to begin from example :
$File = FileOpen("MyFile.txt", "r"); If(isVarObj($File, "file")) { FileSeek($File, 7, "b"); $Str = FileRead($File); println( "String is: " . $Str ); FileClose( $File ); }