Project

General

Profile

Actions

Bug #1203

closed

IO#gets ignores the limit parameter when sep is nil

Added by mike (Michael Selig) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-02-24 trunk 22588) [i686-linux]
Backport:
[ruby-core:22434]

Description

=begin
According to the doc f.gets(nil) returns the rest of the file. This works fine. But the doc also says that "limit" should restrict the length of the character string returned. Therefore I expect
f.gets(nil, 10)
to return the next 10 bytes in the file (rounded up to a character boundary).
However it also seems to return the rest of the file - limit seems to be ignored here.

[Proposal] See issue 908 - I would also like "limit" to mean "characters" not bytes in 1.9. That would allow f.gets(nil, len) to read the next "len" characters in the file, ignoring newlines.
=end

Actions

Also available in: Atom PDF

Like0
Like0