开发者

Reading in long double in the C programming language

开发者 https://www.devze.com 2022-12-08 01:46 出处:网络
How do I read in a long double in 开发者_如何学GoC?long double x; scanf(\"%Lf\", &x);Be aware that \"long double\" is a synonym for \"double\" on Visual Studio.

How do I read in a long double in 开发者_如何学GoC?


long double x; scanf("%Lf", &x);


Be aware that "long double" is a synonym for "double" on Visual Studio.

http://blogs.msdn.com/ericflee/archive/2004/06/10/152852.aspx


Either hrnt's answer (scanf("%Lf", &x)) or

long double x;
if(read(fd,&x,sizeof(x))!=sizeof(x)) printf("Oops\n");

the question is very vague.


you can use the format specifier %ld for reading long double variables.

0

精彩评论

暂无评论...
验证码 换一张
取 消