Buffer to file: Difference between revisions
Jump to navigation
Jump to search
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..." |
mNo edit summary |
||
Line 9: | Line 9: | ||
|function1.param2.type=string | |function1.param2.type=string | ||
|function1.param2.description=Path to the text file to save | |function1.param2.description=Path to the text file to save | ||
|description= | |description=This function was added in [https://kolmafia.us/threads/19439-you-can-create-a-bottle-of-sea-wine-by-using-a-bunch-of-sea-grapes-add-some-a.24054/ r19439]. | ||
|code1={{CodeSample | |code1={{CodeSample | ||
|title=Code Samples | |title=Code Samples |
Latest revision as of 05:33, 21 December 2020
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");
}