- This wiki is out of date, use the continuation of this wiki instead
Load
From FenixWiki
Contents |
[edit] Definition
INT load ( <STRING filename> , <VARSPACE data> )
Loads the data read from the specified file into the specified variable.
[edit] 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. |
[edit] Returns
INT : The number of bytes read from the file.
[edit] Notes
To check whether a file exists before it is loaded, file_exists() can be used.
[edit] 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(), load(), write(), key()
Files Functions | |
• Cd() • Chdir() • Fclose() • Feof() • Fgets() • File() • File_exists() • Flength() • Fopen() • Fputs() • Fread() • Fseek() • Ftell() • Fwrite() • Glob() • Load() • Mkdir() • Rmdir() • Save() • |