Project

General

Profile

Actions

Feature #908

closed

Should be an easy way of reading N characters from am I/O stream

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

Status:
Rejected
Target version:
[ruby-core:20706]

Description

=begin
I know of no way of reading N characters (as opposed to bytes) and returning a string other than writing a loop with getc or each_char.

Suggestions - one of:

  1. Change the "limit" paramater on IO#gets to mean characters rather than bytes. This would change existing behaviour, so may be unacceptable.

  2. Add an optional "limit" parameter to IO#getc, so IO#getc will read up to this many characters
    =end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0