octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #33722] sscanf inconsistent behaviour with str


From: Pascal Dupuis
Subject: [Octave-bug-tracker] [bug #33722] sscanf inconsistent behaviour with strings containing 'I'
Date: Wed, 06 Jul 2011 13:01:11 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110628 Ubuntu/10.04 (lucid) Firefox/3.6.18

URL:
  <http://savannah.gnu.org/bugs/?33722>

                 Summary: sscanf inconsistent behaviour with strings
containing 'I'
                 Project: GNU Octave
            Submitted by: cdemills
            Submitted on: mer. 06 juil. 2011 13:01:10 GMT
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Pascal Dupuis
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.4.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Hello,
working in the context of electrical measurements, my colleagues often produce
file whose first line contains 'I' (for current). I then observed this strange
behaviour of sscanf:
[val, count]=sscanf("1L2", "%f")
val =  1.0000e+00
count =  1.0000e+00
OK: the parser stops at 'L'
[val, count]=sscanf("L2", "%f")
val = [](0x1)
count =  0.0000e+00
OK: 'L' is not the beginning of a number
[val, count]=sscanf("3I2", "%f")
val =

   3.0000e+00
   3.0000e+00
count =  2.0000e+00
Where thus the second value (3) come from ?

[val, count]=sscanf("I2", "%f")
val =  0.0000e+00
count =  1.0000e+00
why does it produce a zero ? 

The expected behavior should be:
- returns a single value for "3I2"
- returns an empty value for "I2"

Regards

Pasca




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?33722>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]