Core Function FileLoad

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> FileSave( <file> ) </pre> === Description === Load all text from a file. === Parameters === ==== file ==== File name. === Return Value === Success: Returns the tex...")
 
m (1 revision)
 
(3 intermediate revisions by one user not shown)
Line 17: Line 17:
 
Success: Returns the text from the file
 
Success: Returns the text from the file
  
Failure: Returns 0 if error occurs.
+
Failure: Returns empty string
  
 
=== Remarks ===
 
=== Remarks ===
Line 26: Line 26:
  
 
<syntaxhighlight lang="sputnik">
 
<syntaxhighlight lang="sputnik">
$TextSave = "Hello World!"
+
$TextSave = "Hello World!";
FileSave("Hello.txt", $TextSave)
+
FileSave("Hello.txt", $TextSave);
$Text = FileLoad("Hello.txt")
+
$Text = FileLoad("Hello.txt");
println( "File text: " . $Text )
+
println( "File text: " . $Text );
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:Core Function]]
 
[[Category:Core Function]]

Latest revision as of 12:38, 14 June 2015

FileSave( <file> ) 

Contents

Description

Load all text from a file.

Parameters

file

File name.

Return Value

Success: Returns the text from the file

Failure: Returns empty string

Remarks

You cannot use a FileHandle with this.

Example

$TextSave = "Hello World!";
FileSave("Hello.txt", $TextSave);
$Text = FileLoad("Hello.txt");
println( "File text: " . $Text );
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox