mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 20:04:18 +00:00
add examples to top of module for stringStream and fileStream
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user