diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2008-12-12 14:02:27 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2008-12-12 14:02:27 +0100 |
commit | ddaedab835fa7ea3457f21a772d636921defdc46 (patch) | |
tree | 8f96b5a3a6700704e0a64bdcdedee1d2caf68517 /lib/sysio.nim | |
parent | 2cd136cf7a0210e3cfde7a6f8ba32c9f09560047 (diff) | |
download | Nim-ddaedab835fa7ea3457f21a772d636921defdc46.tar.gz |
version 0.7.2
Diffstat (limited to 'lib/sysio.nim')
-rw-r--r-- | lib/sysio.nim | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/sysio.nim b/lib/sysio.nim index 8887effa8..c178ff559 100644 --- a/lib/sysio.nim +++ b/lib/sysio.nim @@ -53,6 +53,16 @@ proc readLine(f: TFile): string = result = "" rawReadLine(f, result) +proc write(f: TFile, s: string) = fputs(s, f) +proc write(f: TFile, i: int) = fprintf(f, "%ld", i) +proc write(f: TFile, b: bool) = + if b: write(f, "true") + else: write(f, "false") +proc write(f: TFile, r: float) = fprintf(f, "%g", r) +proc write(f: TFile, c: Char) = putc(c, f) +proc write(f: TFile, a: openArray[string]) = + for x in items(a): write(f, x) + proc readFile(filename: string): string = var f: TFile try: @@ -68,16 +78,6 @@ proc readFile(filename: string): string = except EIO: result = nil -proc write(f: TFile, s: string) = fputs(s, f) -proc write(f: TFile, i: int) = fprintf(f, "%ld", i) -proc write(f: TFile, b: bool) = - if b: write(f, "true") - else: write(f, "false") -proc write(f: TFile, r: float) = fprintf(f, "%g", r) -proc write(f: TFile, c: Char) = putc(c, f) -proc write(f: TFile, a: openArray[string]) = - for x in items(a): write(f, x) - proc EndOfFile(f: TFile): bool = # do not blame me; blame the ANSI C standard this is so brain-damaged var |