CRE8OR - game maker for anim8or |
||
|
FILE IO
When you write to a file, you'll need to use the opne a file, like so: file_ handle = fopen(file_name, open_type) Where file_name is the name of the file in quotes. And open_type is how the file is opened, use "rb" for Read Binary and "wr" for Write Binary: local file_handle = fopen("game.dat", "wb"); For writing objects to a file you can use the following: fwrite_int(integer, file_handle) fwrite_flt(float, file_handle) fwrite_bool(boolean, file_handle) fwrite_str(string, file_handle) //write line For reading from a file integer = fread_int(file_handle) float = fread_flt(file_handle) bool = fread_bool(file_handle) string = fread_ln(file_handle) Example: //write variables Always reme,ber to close the file after reading or writing: fexists(file_name); To create a directory use: mkdir(directory);
|
|
Copyrights (C) 2007 Keith Tabert |
||