Read entire file: Difference between revisions

Added Wren
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
(Added Wren)
Line 1,964:
whilet line (read_line)
prn line</lang>
 
=={{header|Wren}}==
Wren's ''File.Read(path)'' static method reads the entire contents of the file at path and returns it as a string.
 
As per the documentation: "No encoding or decoding is done. If the file is UTF-8, then the resulting string will be a UTF-8 string. Otherwise, it will be a string of bytes in whatever encoding the file uses."
For the following script, a file called "input.txt" has been created which contains the string "abcdefghijklmnopqrstuvwxyz".
<lang ecmascript>import "io" for File
 
System.print(File.read("input.txt"))</lang>
 
{{out}}
<pre>
abcdefghijklmnopqrstuvwxyz
</pre>
 
=={{header|XPL0}}==
9,476

edits