add examples to top of module for stringStream and fileStream

This commit is contained in:
JamesP
2015-09-26 08:18:09 +10:00
parent 9352772174
commit eed1000252

View File

@@ -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"