buffer_to_file
Revision as of 05:32, 21 December 2020 by Philmasterplus (talk | contribs) (Created page with "<onlyinclude>{{{{{format|Function2}}} |name=buffer_to_file |function1.return_type=boolean |function1.description=Saves a buffer to a text file. Returns <code>true</code> on su...")
Function Syntax
boolean buffer_to_file( buffer data, string filepath )
- Saves a buffer to a text file. Returns
true
on success,false
on failure.- data: Buffer to save
- filepath: Path to the text file to save
This function was added in r19439.
Code Samples
Saves a string (automatically converted to a buffer) to a text file.
string contents = "Hello, world!";
if (!buffer_to_file(contents, "mydata.txt")) {
abort("Failed to save data to mydata.txt");
}