diff options
Diffstat (limited to 'lib/pure/streams.nim')
-rw-r--r-- | lib/pure/streams.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 4a196127c..764471b78 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -106,6 +106,12 @@ proc write*(s: PStream, x: string) = ## terminating zero is written. writeData(s, cstring(x), x.len) +proc writeln*(s: PStream, args: varargs[string, `$`]) = + ## writes one or more strings to the the stream `s` followed + ## by a new line. No length field or terminating zero is written. + for str in args: write(s, str) + write(s, "\n") + proc read[T](s: PStream, result: var T) = ## generic read procedure. Reads `result` from the stream `s`. if readData(s, addr(result), sizeof(T)) != sizeof(T): |