Load
Jump to navigation
Jump to search
Definition
INT load ( <STRING filename> , <VARSPACE data> )
Loads the data read from the specified file into the specified 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(), load(), write(), key()
Files Functions | |
Cd()Chdir()Dirclose()Diropen()Dirread()Fclose()Feof()Fexists()Fflush()Fgets()File()Flength()Fmove()Fopen()Fputs()Fread()Fremove()Frewind()Fseek()Ftell()Fwrite()Glob()Load()Mkdir()Rm()Rmdir()Save() |