From 04f9c2585ae53555cdbec4031b0d9af270b8dc86 Mon Sep 17 00:00:00 2001 From: Araq <rumpf_a@web.de> Date: Thu, 16 Jun 2011 10:47:44 +0200 Subject: readFile raises EIO instead of returning nil; added system.writeFile --- lib/system.nim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/system.nim') diff --git a/lib/system.nim b/lib/system.nim index 7670288fc..1837959c7 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -1582,10 +1582,15 @@ when not defined(EcmaScript) and not defined(NimrodVM): ## Flushes `f`'s buffer. proc readFile*(filename: string): string - ## Opens a file name `filename` for reading. Then reads the + ## Opens a file named `filename` for reading. Then reads the ## file's content completely into a string and - ## closes the file afterwards. Returns the string. Returns nil if there was - ## an error. Does not throw an IO exception. + ## closes the file afterwards. Returns the string. + ## Raises an IO exception in case of an error. + + proc writeFile*(filename, content: string) + ## Opens a file named `filename` for writing. Then writes the + ## `content` completely to the file and closes the file afterwards. + ## Raises an IO exception in case of an error. proc write*(f: TFile, r: float) proc write*(f: TFile, i: int) -- cgit 1.4.1-2-gfad0