steam_file_write

Write a data string to a file for storage on the Steam Cloud.

Syntax:

GML Code Example

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:

GML Code 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.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here