In article
<ae12db6f-80d8-4cf1-a1c4-282f989c8490@[EMAIL PROTECTED]
>,
Robert <Ritterhaus@[EMAIL PROTECTED]
> wrote:
> I can't seem to get sscanf to work for some odd reason on my Macbook
> Pro. The following code:
>
> sscanf(string, "%f", &double_var);
>
> Doesn't do as expected. According to gdb, double_var goes from 0.0
> (where I initialized it) to 5.14...e-315 (a number so small, it is
> essentially zero.) Even if I use a string literal:
>
> sscanf("123.456789", "%f", &double_var);
>
> I get similar results---a tiny number that is basically equivalent to
> zero. Any thoughts? Anyone else run into this?
From
http://www.cplusplus.com/reference/clibrary/cstdio/sscanf.html
The format specifier %f will scan for a float, not a double. (I'm
assuming the double_var is declared double.) If you're reading a double
var, you need to give the format specifier %lf
Hope this helps.
--
William Edward Woody - woody@[EMAIL PROTECTED]
In Motion - http://www.chaosinmotion.com
Freedom is the non-negotiable demand of human dignity;
the birthright of every person‹-in every civilization.
- National Security Strategy of the United States


|