bugGNU Octave - Bugs: bug #51794, fscanf / sscanf unable to read...

 
 

bug #51794: fscanf / sscanf unable to read long integers in "C-like" form

Submitted by:  None
Submitted on:  Sat 19 Aug 2017 06:17:02 PM UTC  
 
Category: Octave FunctionSeverity: 1 - Wish
Priority: 3 - LowItem Group: Feature Request
Status: FixedAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: ClosedRelease: 4.0.3
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 29 Aug 2017 06:03:25 PM UTC, comment #4:

I pushed this change:

http://hg.savannah.gnu.org/hgweb/octave/rev/b833c7334308

Closing as fixed.

John W. Eaton <jwe>
Project Administrator
Tue 29 Aug 2017 05:27:43 PM UTC, comment #3:

Yeah this seems like the right thing to do, change looks good and works for me, thank you. Please do update the docs.

Mike Miller <mtmiller>
Project Administrator
Tue 29 Aug 2017 04:32:01 PM UTC, comment #2:

Mike: It seems like we should do the same thing that you did here

http://hg.savannah.gnu.org/hgweb/octave/rev/f07d6f579214

for the default scanf functions, so I pushed the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/6f0c2963674b

If you agree, then I can also update the docs. If not, I could revert the change.

John W. Eaton <jwe>
Project Administrator
Mon 21 Aug 2017 07:13:29 PM UTC, comment #1:

Note that the documentation explicitly says

> Unlike the C language ‘scanf’, Octave ignores the ‘h’, ‘l’, and ‘L’ modifiers.


This might be a consideration for an enhancement, but is not incorrect when it is behaving according to the docs.

In Octave 4.2 an integer value is returned, but it is limited to the maximum signed 32-bit value.

Mike Miller <mtmiller>
Project Administrator
Sat 19 Aug 2017 06:17:02 PM UTC, original submission:

fscanf(stdin, "%ld", 1) will read integers exceeding 2^32 correctly. For example with 9007199254740991 it'll return:
ans = 9.0072e+15

while fscanf(stdin, "%ld", "C") will return ans = [](0x0).

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 29 Aug 2017 06:03:25 PM UTCjweStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Tue 29 Aug 2017 04:32:01 PM UTCjweStatusNone=>Ready For Test
    Mon 21 Aug 2017 07:13:29 PM UTCmtmillerSeverity3 - Normal=>1 - Wish
      Priority5 - Normal=>3 - Low
      Item GroupIncorrect Result=>Feature Request
      Summaryfscanf return empty result when trying to read long ints in "C-like" form=>fscanf / sscanf unable to read long integers in "C-like" form

    Back to the top


    Powered by Savane 3.1-cleanup1