public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Arthur Schwarz" <aschwarz1309@att.net>
To: <cygwin@cygwin.com>
Subject: gcc 4.8.2 runtime library error
Date: Wed, 28 May 2014 17:13:00 -0000	[thread overview]
Message-ID: <A8D6723F31474D8D8B1D6589BDC1113B@2600kPC> (raw)

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

             reply	other threads:[~2014-05-28 15:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28 17:13 Arthur Schwarz [this message]
2014-06-16 17:28 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A8D6723F31474D8D8B1D6589BDC1113B@2600kPC \
    --to=aschwarz1309@att.net \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).