buffer_to_file
Jump to navigation
Jump to search
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");
}