diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim index 16e7a14d606e..7d6c0c7a175c 100644 --- a/lib/system/ansi_c.nim +++ b/lib/system/ansi_c.nim @@ -142,8 +142,12 @@ proc c_realloc*(p: pointer, newsize: csize): pointer {. proc c_fwrite*(buf: pointer, size, n: csize, f: CFilePtr): cint {. importc: "fwrite", header: "".} +proc c_fflush(f: CFilePtr): cint {. + importc: "fflush", header: "".} + proc rawWrite*(f: CFilePtr, s: cstring) {.compilerproc, nonReloadable, inline.} = # we cannot throw an exception here! discard c_fwrite(s, 1, s.len, f) + discard c_fflush(f) {.pop.}