summaryrefslogtreecommitdiff
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
commit9ceeedb8745e48d18cfecf1764afc67bf4dc29cd (patch)
treeb130749bd2881cf61a03ff2e467c2bf225736404
parent5aff9f3b3a302977a48b57ddbd9a4ed14b653785 (diff)
fix IO#read docment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--io.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/io.c b/io.c
index 1085e81c54..b8e25c19eb 100644
--- a/io.c
+++ b/io.c
@@ -1223,14 +1223,20 @@ io_readpartial(int argc, VALUE *argv, VALUE io)
/*
* call-seq:
- * ios.read([integer [, 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>.
+ * ios.read([length [, buffer]]) => string, buffer, or nil
+ *
+ * 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.
+ *
* f = File.new("testfile")
* f.read(16) #=> "This is line one"
*/