- This wiki is out of date, use the continuation of this wiki instead
Load
From FenixWiki
Revision as of 09:38, 23 May 2008 by 85.144.194.29 (Talk)
Contents |
Definition
INT load ( <STRING filename> , <VARSPACE data> )
Loads the data read from the specified file into a variable.
Parameters
STRING filename | - The name of the file to be loaded. |
VARSPACE data | - The variable (of any datatype) in which the data read from the file will be loaded. |
Returns
INT : The number of bytes read from the file.
Notes
To check whether a file exists before it is loaded, file_exists() can be used.
Example
Program test; Global struct My_struct Level_number; string Map_name; End Begin If (file_exists("myfile.sav")) Load("myfile.sav",My_struct); // Content from myfile.sav is loaded into My_struct Write(0,10,10,0,My_struct.level_number); // A variable from the loaded struct is shown on screen Write(0,10,20,0,My_struct.map_name); // Another variable loaded is shown on screen Else Write(0,10,10,0,"File couldn't be loaded, it doesn't exist."); End While (!key(_esc)) Frame; End End
Used in example: file_exists(), write(), key()