fixes #564
This commit is contained in:
parent
c247b50c00
commit
e2eb9f815e
1 changed files with 6 additions and 5 deletions
|
|
@ -104,13 +104,14 @@ proc getFileHandle*(f: File): FileHandle = c_fileno(f)
|
||||||
|
|
||||||
proc readLine(f: File, line: var TaintedString): bool =
|
proc readLine(f: File, line: var TaintedString): bool =
|
||||||
var pos = 0
|
var pos = 0
|
||||||
# Use the currently reserved space for a first try
|
|
||||||
when defined(nimscript):
|
|
||||||
var space: cint = 80
|
var space: cint = 80
|
||||||
|
# Use the currently reserved space for a first try
|
||||||
|
if line.string.isNil:
|
||||||
|
line = TaintedString(newStringOfCap(80))
|
||||||
else:
|
else:
|
||||||
var space: cint = cint(cast[PGenericSeq](line.string).space)
|
when not defined(nimscript):
|
||||||
|
space = cint(cast[PGenericSeq](line.string).space)
|
||||||
line.string.setLen(space)
|
line.string.setLen(space)
|
||||||
|
|
||||||
while true:
|
while true:
|
||||||
# memset to \l so that we can tell how far fgets wrote, even on EOF, where
|
# memset to \l so that we can tell how far fgets wrote, even on EOF, where
|
||||||
# fgets doesn't append an \l
|
# fgets doesn't append an \l
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue