RE: Possible 4.8.2 runtime library bug for sscanf

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

 



Win 7 64-bit
gcc 4.8.2 (64-bit) cygwin

ref: http://stackoverflow.com/questions/23900921/c-scanf-la-returns-0

I don?t know whether you or cygwin supports the gcc runtime library. The
reference shows that sscanf works correctly in a Linux environment but not a
cygwin environment. The thought is that the fault is in the runtime library.

sscanf() doesn't handle "%la" correctly and crashes on "%a". 

Sample code and output:
# include <stdio.h>
# include <iostream>

#include <cstdlib>

using namespace std;
int main(int argc, char** argv) {
   char buffer[30];
   double x = 5.0;
   sprintf(buffer, "%a", 1.2);
   sscanf(buffer, "%la", &x);
   cout << "    Example 1.2 buffer -> " << buffer << endl;
   cout << "    Example 1.2 scanf <- " << x << endl;

   return 0;
}
output 
 Example 1.2 buffer -> 0x1.3333333333333p+0
 Example 1.2 scanf <- 0









[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux