469,592 Members | 1,856 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

regarding format specifier %lg in sscanf

I am reading a character array which has value 9.9999 into a double variable using sscanf. the statement is like this:
double dvar1;
char cvar[256] = "9.9999";
sscanf(cvar, "%lG", &dvar);
printf("%lG", dvar);

now when I run the program on a solaris machine using sunwspro CC, it works fine, but on gcc or pgcc on interix machine does not output the value correctly. I have to use the format specifier %lg for gcc on interix to get the output correctly. Can anybody explain why is it like this? is %lG not supported in gcc/pgcc, I can see its use in printf but not in scanf.
Jul 30 '10 #1
1 4255
donbock
2,423 Expert 2GB
I don't think the uppercase G conversion specifier is Standard C. In my opinion, you should have been using "%lg" from the beginning.
Jul 30 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

18 posts views Thread by Money | last post: by
1 post views Thread by dis_is_eagle | last post: by
2 posts views Thread by =?Utf-8?B?Um9ubmllIFNtaXRo?= | last post: by
1 post views Thread by raghunadhs | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.