remove fileError
This commit is contained in:
parent
88247e6857
commit
1def8ec9f9
2 changed files with 1 additions and 7 deletions
|
|
@ -2596,9 +2596,6 @@ when not defined(JS): #and not defined(nimscript):
|
||||||
proc endOfFile*(f: File): bool {.tags: [], benign.}
|
proc endOfFile*(f: File): bool {.tags: [], benign.}
|
||||||
## Returns true iff `f` is at the end.
|
## Returns true iff `f` is at the end.
|
||||||
|
|
||||||
proc fileError*(f: File): bool {.tags: [], benign.}
|
|
||||||
## Returns true iff the error indicator of `f` is set.
|
|
||||||
|
|
||||||
proc readChar*(f: File): char {.
|
proc readChar*(f: File): char {.
|
||||||
importc: "fgetc", header: "<stdio.h>", tags: [ReadIOEffect].}
|
importc: "fgetc", header: "<stdio.h>", tags: [ReadIOEffect].}
|
||||||
## Reads a single character from the stream `f`.
|
## Reads a single character from the stream `f`.
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ proc readAllFile(file: File, len: int): string =
|
||||||
if endOfFile(file):
|
if endOfFile(file):
|
||||||
if bytes < len:
|
if bytes < len:
|
||||||
result.setLen(bytes)
|
result.setLen(bytes)
|
||||||
elif fileError(file):
|
elif ferror(file) != 0:
|
||||||
raiseEIO("error while reading from file")
|
raiseEIO("error while reading from file")
|
||||||
else:
|
else:
|
||||||
# We read all the bytes but did not reach the EOF
|
# We read all the bytes but did not reach the EOF
|
||||||
|
|
@ -196,9 +196,6 @@ proc endOfFile(f: File): bool =
|
||||||
ungetc(c, f)
|
ungetc(c, f)
|
||||||
return c < 0'i32
|
return c < 0'i32
|
||||||
|
|
||||||
proc fileError(f: File): bool =
|
|
||||||
result = (ferror(f) != 0)
|
|
||||||
|
|
||||||
proc writeLn[Ty](f: File, x: varargs[Ty, `$`]) =
|
proc writeLn[Ty](f: File, x: varargs[Ty, `$`]) =
|
||||||
for i in items(x):
|
for i in items(x):
|
||||||
write(f, i)
|
write(f, i)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue