Core Function FileRead

From Sputnik Wiki
Revision as of 10:39, 9 November 2011 by UberFoX (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
FileRead( <file>, <expression> )

Contents

Description

Read a number of characters from a previously opened text file starting from current File Steam pointer location.

Parameters

file

A variable containing the File handle.

expression

Optional; Number of letters 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 0 if error occurs.

Remarks

N/A

Example

$File = FileOpen("MyFile.txt", "r")
If isObj($File, "file") Then
	$Str = FileRead($File)
	println( "String is: " . $Str )
	FileClose( $File )
EndIf

You could also tell it where to begin from example :

$File = FileOpen("MyFile.txt", "r")
If isObj($File, "file") Then
	FileSeek($File, 7, "b")
	$Str = FileRead($File)
	println( "String is: " . $Str )
	FileClose( $File )
EndIf
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox