From eed1000252444850523aa5ffe7d86782bd48a26a Mon Sep 17 00:00:00 2001 From: JamesP Date: Sat, 26 Sep 2015 08:18:09 +1000 Subject: [PATCH] add examples to top of module for stringStream and fileStream --- lib/pure/streams.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 8aa8d35d88..3be47744ca 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -11,6 +11,26 @@ ## the `FileStream` and the `StringStream` which implement the stream ## interface for Nim file objects (`File`) and strings. Other modules ## may provide other implementations for this standard stream interface. +## +## Examples: +## +## .. code-block:: Nim +## +## import streams +## var +## ss = newStringStream("""The first line +## the second line +## the third line""") +## line = "" +## while ss.readLine(line): +## echo line +## ss.close() +## +## var fs = newFileStream("somefile.txt", fmRead) +## if not isNil(fs): +## while fs.readLine(line): +## echo line +## fs.close() include "system/inclrtl"