This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc 4.8.2 runtime library error


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

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

I don't know whether cygwin or gcc.org maintains the runtime library. If
this is the wrong location I'll redirect this e-mail.

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

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

#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



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]