steam_file_write

Syntax:

steam_file_write(filename, data, size);


Argument Description
filename The name of the file to write to.
data The data to write (a string).
size the size of the data to be written.


Returns: Real


Description

You can use this function to write data to a file, which will then be synchronised with the Steam Cloud when the user exits the game. if the file does not exist, this function will create it for you, and if it does already exists, it will overwrite any data that is already stored within the file with the new data string. The function will return a value of 0 if it fails for whatever reason and a value greater than 0 if it succeeds.


Example:

var fname="SaveData.txt";
var data = string(global.Level) + "|" + string(global.Points) + "|" + string(global.HP);
var len = string_length(data);
steam_file_write_file(fname, data, len);

The above code will prepare a number of local variables and then use them to write to (or create) a file which will then be synchronised with the Steam Cloud.