summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-24 11:43:12 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-24 11:43:12 +0000
commit66739f720d095b3ad7659666d905255f7e2057bb (patch)
tree0a869ab72173abcb7049486fc53620660ce3ebdc /io.c
parent0a310d08da7d721a9912c0bd3b6ca5547d2a0c9e (diff)
fix IO#read docment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/io.c b/io.c
index f3c7ed6081..04807d7488 100644
--- a/io.c
+++ b/io.c
@@ -1302,13 +1302,21 @@ io_readpartial(argc, argv, io)
/*
* call-seq:
- * ios.read([integer [, buffer]]) => string, buffer, or nil
+ * ios.read([length [, buffer]]) => string, buffer, or nil
*
- * Reads at most <i>integer</i> bytes from the I/O stream, or to the
- * end of file if <i>integer</i> is omitted or is <code>nil</code>.
+ * Reads at most <i>length</i> bytes from the I/O stream, or to the
+ * end of file if <i>length</i> is omitted or is <code>nil</code>.
+ * <i>length</i> must be a non-negative integer or nil.
* If the optional <i>buffer</i> argument is present, it must reference
- * a String, which will receive the data. Returns <code>nil</code>
- * if called at end of file.
+ * a String, which will receive the data.
+ *
+ * At end of file, it returns <code>nil</code> or <code>""</code>
+ * depend on <i>length</i>.
+ * <code><i>ios</i>.read()</code> and
+ * <code><i>ios</i>.read(nil)</code> returns <code>""</code>.
+ * <code><i>ios</i>.read(<i>positive-integer</i>)</code> returns nil.
+ *
+ * <code><i>ios</i>.read(0)</code> returns <code>""</code>.
*
* f = File.new("testfile")
* f.read(16) #=> "This is line one"