Standard Library
class FileOutStream
A stream that writes text to a file descriptor.
since 0.1.0-alpha.1linux
Overview
Get one from File.writer(), or wrap a descriptor yourself (1 is standard output). Use << to write, and chain several writes in one statement.
Examples
Writing to a file with the stream operator
using File file = File("notes.txt", std::write);
FileOutStream output = file.writer();
output << "first line\n" << "second line\n";
not run — writes a file
Constructors
new
new(int f)Creates a stream that writes to a file descriptor.
Parameters
- f
- The descriptor to write to.
Operators
<<
<<(string s) -> FileOutStreamWrites text to the file and returns the stream, so writes can be chained.
Parameters
- s
- The text to write.
Returns
This stream.
See also
- writer — Returns a stream that writes to this file, to use with
<<. - FileInStream — A stream that reads text from a file descriptor.