summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorJamesP <jlp765@gmail.com>2015-09-26 08:18:09 +1000
committerJamesP <jlp765@gmail.com>2015-09-26 08:18:09 +1000
commiteed1000252444850523aa5ffe7d86782bd48a26a (patch)
tree6842c21ece190a6a25f89af88e0fe48c7630081d /lib
parent93527721744bf2af5a43677c710616d2691bb522 (diff)
downloadNim-eed1000252444850523aa5ffe7d86782bd48a26a.tar.gz
add examples to top of module for stringStream and fileStream
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/streams.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim
index 8aa8d35d8..3be47744c 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"