Project

General

Profile

Bug #459

Scanf Seems to Have Issues with Single Digit Integers

Added by JEG2 (James Gray) over 11 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
[ruby-core:18355]

Description

=begin
Switching a trivial example to use single digit integers causes scanf() to perform unexpectedly:

$ ruby -r scanf -e '"Name James Age 32 Name Greg Age 22".scanf("Name %s Age %i") { |name, age| p [name, age] }'
["James", 32]
["Greg", 22]
$ ruby -r scanf -e '"Name James Computers 2 Name Greg Computers 4".scanf("Name %s Age %i") { |name, age| p [name, age] }'
["James", nil]
=end

History

#1

Updated by JEG2 (James Gray) over 11 years ago

=begin
I apologize, that second example had multiple errors. Here's the correct example, still broken:

$ ruby -r scanf -e '"Name James Computers 2 Name Greg Computers 4".scanf("Name %s Computers %i") { |name, count| p [name, count] }'
["James", nil]

=end

#2

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

  • Status changed from Open to Closed

=begin
Applied in changeset r18744
=end

Also available in: Atom PDF