diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-24 11:43:12 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-24 11:43:12 +0000 |
commit | 9ceeedb8745e48d18cfecf1764afc67bf4dc29cd (patch) | |
tree | b130749bd2881cf61a03ff2e467c2bf225736404 /io.c | |
parent | 5aff9f3b3a302977a48b57ddbd9a4ed14b653785 (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
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -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" */ |