add examples to top of module for stringStream and fileStream
This commit is contained in:
parent
9352772174
commit
eed1000252
1 changed files with 20 additions and 0 deletions
|
|
@ -11,6 +11,26 @@
|
||||||
## the `FileStream` and the `StringStream` which implement the stream
|
## the `FileStream` and the `StringStream` which implement the stream
|
||||||
## interface for Nim file objects (`File`) and strings. Other modules
|
## interface for Nim file objects (`File`) and strings. Other modules
|
||||||
## may provide other implementations for this standard stream interface.
|
## 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"
|
include "system/inclrtl"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue