diff options
author | Andreas Rumpf <andreas@andreas-desktop> | 2010-01-29 01:50:39 +0100 |
---|---|---|
committer | Andreas Rumpf <andreas@andreas-desktop> | 2010-01-29 01:50:39 +0100 |
commit | ecb5a8db9997dd9b986e7b5649af5b45561f871b (patch) | |
tree | a48a6a770b7319b9d9508299031c9f799e976e2e /lib/system/sysio.nim | |
parent | 5eea125ba73a5768a264c5d4fc8cc55fba8d5fe8 (diff) | |
download | Nim-ecb5a8db9997dd9b986e7b5649af5b45561f871b.tar.gz |
bugfixes for the high-level postgreSQL wrapper
Diffstat (limited to 'lib/system/sysio.nim')
-rwxr-xr-x | lib/system/sysio.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim index 8b6d0e285..3c99a5eed 100755 --- a/lib/system/sysio.nim +++ b/lib/system/sysio.nim @@ -51,7 +51,6 @@ proc readLine(f: TFile): string = result = "" rawReadLine(f, result) -proc write(f: TFile, s: string) = fputs(s, f) proc write(f: TFile, i: int) = when sizeof(int) == 8: fprintf(f, "%lld", i) @@ -167,6 +166,10 @@ proc writeChars(f: TFile, a: openarray[char], start, len: int): int = proc writeBuffer(f: TFile, buffer: pointer, len: int): int = result = fwrite(buffer, 1, len, f) +proc write(f: TFile, s: string) = + if writeBuffer(f, cstring(s), s.len) != s.len: + raise newException(EIO, "cannot write string to file") + proc setFilePos(f: TFile, pos: int64) = if fseek(f, clong(pos), 0) != 0: raise newException(EIO, "cannot set file position") |