Merge pull request #3378 from jlp765/streamsEx
Streams examples & default newFileStream() file mode
This commit is contained in:
commit
0370dff8e0
2 changed files with 34 additions and 1 deletions
13
tests/stdlib/tstreams2.nim
Normal file
13
tests/stdlib/tstreams2.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
discard """
|
||||
file: "tstreams2.nim"
|
||||
output: '''fs is: nil'''
|
||||
"""
|
||||
import streams
|
||||
var
|
||||
fs = newFileStream("amissingfile.txt")
|
||||
line = ""
|
||||
echo "fs is: ",repr(fs)
|
||||
if not isNil(fs):
|
||||
while fs.readLine(line):
|
||||
echo line
|
||||
fs.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue