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 | 1a91617a046da8ca859760c11e6237784e37464c (patch) | |
tree | 0a869ab72173abcb7049486fc53620660ce3ebdc /io.c | |
parent | fe8f38cdd4cb6e170fcbe91ee81cbe2cbd600138 (diff) | |
download | ruby-1a91617a046da8ca859760c11e6237784e37464c.tar.gz ruby-1a91617a046da8ca859760c11e6237784e37464c.tar.xz ruby-1a91617a046da8ca859760c11e6237784e37464c.zip |
fix IO#read docment.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -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" |