Difference between revisions of "File to buffer"

From Kolmafia
Jump to navigation Jump to search
m
 
Line 19: Line 19:
 
   |moreinfo=
 
   |moreinfo=
 
}}
 
}}
|see_also={{SeeAlso|file_to_array|file_to_map|map_to_file}}
+
|see_also={{SeeAlso|buffer_to_file|file_to_array|file_to_map|map_to_file}}
 
|cli_equiv=
 
|cli_equiv=
 
|more_info=
 
|more_info=

Latest revision as of 05:33, 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

buffer_to_file() | file_to_array() | file_to_map() | map_to_file()