Core Function FileReadText

From Sputnik Wiki
Jump to: navigation, search
FileReadText( <file>, <format>, <length> )

Contents

Description

Read text from a file opened by FileOpenText() using the format and length params .

Parameters

file

The text file "handle" to read from. (The one you got from FileOpenText())

format

Mode to read the choices are:

Note if you use "c" you may also supply a number of chars you wish to wish after it

Return Value

Success: Returns the string containing hte information you asked for.

Failure: Returns an empty string.

Remarks

N/A

Example

// Open the file and return the handle
my $f = FileOpenText("Main.spk");
if ($f)
{
	// Read the first line
	say FileReadText($f, 'l');
	// Read the second line
	say FileReadText($f, 'l');
	// Read a char
	say FileReadText($f, 'c');
	// Read a 8 char
	say FileReadText($f, 'c', 8);
	// Read to the end of the file
	say FileReadText($f, 'e');
}
// free the handle
FileClose($f);
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox