summary refs log tree commit diff stats
path: root/lib/system/sysio.nim
diff options
context:
space:
mode:
authoraraq <rumpf_a@web.de>2017-02-15 22:09:16 +0100
committeraraq <rumpf_a@web.de>2017-02-15 22:09:16 +0100
commit1811e51ff5dc0213a5abfd0f2bb32729f40c0344 (patch)
tree9d2945d72f9ff8b6ac1f76fc404fb0000f322783 /lib/system/sysio.nim
parent55782205a4bcbe8584fbb96425ae530a302be15f (diff)
downloadNim-1811e51ff5dc0213a5abfd0f2bb32729f40c0344.tar.gz
fixes #5392
Diffstat (limited to 'lib/system/sysio.nim')
-rw-r--r--lib/system/sysio.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim
index fa1bdbb4e..7444661e3 100644
--- a/lib/system/sysio.nim
+++ b/lib/system/sysio.nim
@@ -215,7 +215,10 @@ proc rawFileSize(file: File): int =
   discard c_fseek(file, clong(oldPos), 0)
 
 proc endOfFile(f: File): bool =
-  result = c_feof(f) != 0
+  var c = c_fgetc(f)
+  discard c_ungetc(c, f)
+  return c < 0'i32
+  #result = c_feof(f) != 0
 
 proc readAllFile(file: File, len: int): string =
   # We acquire the filesize beforehand and hope it doesn't change.