mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 18:32:11 +00:00
fixes #564
This commit is contained in:
@@ -104,13 +104,14 @@ proc getFileHandle*(f: File): FileHandle = c_fileno(f)
|
||||
|
||||
proc readLine(f: File, line: var TaintedString): bool =
|
||||
var pos = 0
|
||||
var space: cint = 80
|
||||
# Use the currently reserved space for a first try
|
||||
when defined(nimscript):
|
||||
var space: cint = 80
|
||||
if line.string.isNil:
|
||||
line = TaintedString(newStringOfCap(80))
|
||||
else:
|
||||
var space: cint = cint(cast[PGenericSeq](line.string).space)
|
||||
line.string.setLen(space)
|
||||
|
||||
when not defined(nimscript):
|
||||
space = cint(cast[PGenericSeq](line.string).space)
|
||||
line.string.setLen(space)
|
||||
while true:
|
||||
# memset to \l so that we can tell how far fgets wrote, even on EOF, where
|
||||
# fgets doesn't append an \l
|
||||
|
||||
Reference in New Issue
Block a user