file_text_open_from_string

Creates a temporary text file from a string for reading.

Syntax:

file_text_open_from_string(string);


Argument Description
string The string to create the file from.


Returns: Real


Description

This function will create a text file from a string and open it for reading, returning the file "handle" that should be used in all further file function calls to read from this file. Note that this file is temporary and read only, and as such it will be removed from memory the moment it is closed.


NOTE: You can only have a maximum of 32 files open at any one time. You should also always close files when finished as this frees the memory associated with the file.

WARNING! This function may not work as you expect due to GameMaker: Studio being sandboxed! Please see the section on File System Limits for more information.


Example:

file = file_text_open_from_string(reset_str);

The above code takes the string stored in the variable "reset_str" and uses it to create a read-only text file. The "handle" for this file is then stored in the variable "file" for all further file functions to use.


Back: Text Files
Next: file_text_read_real
© Copyright YoYo Games Ltd. 2018 All Rights Reserved