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

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

[Octave-bug-tracker] [bug #54892] sscanf %1c returns more than one chara


From: Rik
Subject: [Octave-bug-tracker] [bug #54892] sscanf %1c returns more than one character
Date: Thu, 25 Oct 2018 21:34:05 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0

Update of bug #54892 (project octave):

                  Status:                    None => Invalid                
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

This is expected.  See the documentation for sscanf.  The third argument is
the number of times the pattern should be read.  It defaults to Inf, in other
words, as many as possible.  You can check this by using the second output
argument which returns how many pattern was applied.


octave:11> [h,n] =sscanf(g,"%1c") 
h = Hello World
n =  11


Here's an example of reading a single character with sscanf.


octave:13> [h, n] = sscanf (g, "%1c", 1)
h = H
n =  1





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54892>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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