473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 4724
donbock
2,426 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

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

Similar topics

4
by: indushekara | last post by:
Hi, We are having memory corruption in our application somewhere, unable to find out. one part of code we found that we are specifying wrong format specifier. Could anyone let me know if the...
18
by: Money | last post by:
Here in this thread http://groups.google.co.in/group/comp.lang.c/browse_frm/thread/c16d280238a95c9/e3b0dbf76f3e02e3?q=finding+endianness&rnum=1#e3b0dbf76f3e02e3 Tydr Schnubbis in 3rd reply used...
1
by: dis_is_eagle | last post by:
Hi.i dont know exactly how the format specifier %d works.please explain the following program. int main() { int k=5; printf("k=%*d",k,k); return 0; } It gives the output of k= 5.If I omit...
2
by: =?Utf-8?B?Um9ubmllIFNtaXRo?= | last post by:
Hello, I would like to be able to accept a format string in the form of say {0:D2} as an input from a dialog box, and then dynamically format the output string based on this new format...
2
by: ranjiththarayil | last post by:
Consider the following code snippet ------------------ float fi=12.598; printf("\n %.2f \n",fi); ------------------ the output of this would be 12.60 (note when we give the conversion...
1
by: raghunadhs | last post by:
hi! This is raghuandhs. i would like to know the format specifier of unsigned long in c? could you please say any body?
7
by: jayapal | last post by:
Hi all, what is %p format specifier indicates in the printf statement? regards, Jay
1
by: dissectcode | last post by:
Hello - I am looking at a scanf function that takes in a 16 bit unsigned int(UINT16), but its format specifier is %hd. According to ...
7
by: codinginc | last post by:
Hi Everyone, Is it possible to insert format specifier in a form of variable. See example below Standard from char result; float fnum = 3.14159; sprintf( result, "%f", fnum );...
3
amarniit
by: amarniit | last post by:
I am making a project on the basis of numbers........here i need that i print a bigger number whose lenght is more than 300 digits....... while i am doing it in C than i am getting a problem my all...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.