summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-06-16 10:47:44 +0200
committerAraq <rumpf_a@web.de>2011-06-16 10:47:44 +0200
commit04f9c2585ae53555cdbec4031b0d9af270b8dc86 (patch)
tree5432c3fb2b25a70b1e74aed01731be6f74b2ed66 /lib/system.nim
parentde659eba65b5ad098a403449c4b2b1067d04a2cf (diff)
downloadNim-04f9c2585ae53555cdbec4031b0d9af270b8dc86.tar.gz
readFile raises EIO instead of returning nil; added system.writeFile
Diffstat (limited to 'lib/system.nim')
-rwxr-xr-xlib/system.nim11
1 files changed, 8 insertions, 3 deletions
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)