summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/system/ansi_c.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim
index 79311a2f6..b9f719d9e 100644
--- a/lib/system/ansi_c.nim
+++ b/lib/system/ansi_c.nim
@@ -142,8 +142,12 @@ proc c_realloc*(p: pointer, newsize: csize_t): pointer {.
 proc c_fwrite*(buf: pointer, size, n: csize_t, f: CFilePtr): cint {.
   importc: "fwrite", header: "<stdio.h>".}
 
+proc c_fflush(f: CFilePtr): cint {.
+  importc: "fflush", header: "<stdio.h>".}
+
 proc rawWrite*(f: CFilePtr, s: cstring) {.compilerproc, nonReloadable, inline.} =
   # we cannot throw an exception here!
   discard c_fwrite(s, 1, cast[csize_t](s.len), f)
+  discard c_fflush(f)
 
 {.pop.}