Difference between revisions of "File to buffer"

From Kolmafia
Jump to navigation Jump to search
(Created page with "<onlyinclude>{{{{{format|Function2}}} |name=file_to_buffer |function1.return_type=buffer |function1.description=Loads the entire contents of a text file into a buffer. |functi...")
 
m
Line 6: Line 6:
 
|function1.param1.type=string
 
|function1.param1.type=string
 
|function1.param1.description=Path to the text file
 
|function1.param1.description=Path to the text file
|description=<p>This does not ignore empty lines, or lines starting with <code>#</code></p>
+
|description=<p>This does not ignore empty lines, or lines starting with <code>#</code>.</p>
  
 
<p>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].</p>
 
<p>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].</p>

Revision as of 05:22, 21 December 2020

Function Syntax

buffer file_to_bufferstring filepath )

Loads the entire contents of a text file into a buffer.
  • filepath: Path to the text file

This does not ignore empty lines, or lines starting with #.

This function was added in r19439.

Code Samples

Load the contents of a text file.

buffer data = file_to_buffer("mydata.txt");
print(`Number of characters in mydata.txt: {data.length()}`);

See Also

file_to_array() | file_to_map() | map_to_file()