scan:long long int的格式 [英] scan: which format for a long long int

查看:131
本文介绍了scan:long long int的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在scanf中使用哪种格式,

格式化长long int(64位int

__int64在MS VC ++中)。

提前致谢

Which format I have to use in scanf,
to format a long long int (64bits int
__int64 in MS VC++).
Thanks in advance

推荐答案

__ frank__< no *********** @ indirizzo.non.valido>写道:
__frank__ <no***********@indirizzo.non.valido> writes:
我必须在scanf中使用哪种格式,
格式化long long int(64位int
__ int64在MS VC ++中)。
Which format I have to use in scanf,
to format a long long int (64bits int
__int64 in MS VC++).




"%lld",如果您的图书馆支持它。它是C99要求的,但是

当然在C90中有很长的类型。


-

Keith汤普森(The_Other_Keith) ks***@mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。



"%lld", if your library supports it. It''s required by C99, but of
course there was long long type in C90.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


__ frank__写道:
__frank__ wrote:
我必须在scanf中使用哪种格式,
格式化长long int(64位int
MS VC ++中的__int64)。
提前致谢
Which format I have to use in scanf,
to format a long long int (64bits int
__int64 in MS VC++).
Thanks in advance




"%lld"或者%lli。


注意:长长整数类型是自C99以来的语言;

AFAIK,MS VC不会完全支持C99甚至在2005年的Studio中也是如此。

至少在VC ++ 6中,64位类型的语义部分地被打破了。

如果上面的格式不起作用,你有一个64位类型作为

实现特定的扩展;格式应在在线帮助中指定

。否则,你可能不得不在新闻组中询问

或论坛,你的实现是热门话题。


顺便说一句:如果你试图保持你的代码符合,你可以#define

适当的整数转换格式字符串并使用

它们是这样的:


#if(已定义__STDC_VERSION__) &安培;&安培; __STDC_VERSION__> = 199901L

#define MY_SLLFORMAT"%lld"

#define MY_ULLFORMAT"%llu"

#elif ... ... / *请求您的实施* /

..... / *在此定义您的具体实施MY_SLLFORMAT等* /

#else

#error无法定义合适的64位整数格式

#end


.....

printf( Tit(MY_SLLFORMAT)for tat \ n,mylonglongvar);

干杯

Michael

-

电子邮件:我的是/ at / gmx / dot / de地址。



"%lld" or "%lli".

Note: The long long integer types are in the language since C99;
AFAIK, MS VC will not fully support C99 even in their 2005 Studio.
At least in VC++6, the semantics of the 64 bit types were partially
broken.
If the above format does not work, you have a 64 bit type as an
implementation specific extension; the format should be specified
in the online help. Otherwise, you may have to ask in a newsgroup
or forum where your implementation is topical.

BTW: If you try to keep your code conforming, you can #define
the appropriate integer conversion format strings and work with
them like that:

#if (defined __STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define MY_SLLFORMAT "%lld"
# define MY_ULLFORMAT "%llu"
#elif ...... /* ask for your implementation */
...../* Define your implementation specific MY_SLLFORMAT etc here */
#else
# error Cannot define an appropriate 64 bit integer format
#end

.....
printf("Tit (" MY_SLLFORMAT ") for tat\n", mylonglongvar);
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.


Keith Thompson写道:
Keith Thompson wrote:
__frank__< no *********** @ indirizzo.non.valido>写道:
__frank__ <no***********@indirizzo.non.valido> writes:
我必须在scanf中使用哪种格式,格式化一个long long int(64位int
在MS VC ++中__int64)。
Which format I have to use in scanf,
to format a long long int (64bits int
__int64 in MS VC++).



"%lld",如果您的图书馆支持它。这是C99的要求,但是当然在C90中有很长的类型。


"%lld", if your library supports it. It''s required by C99, but of
course there was long long type in C90.



^

no


干杯

Michael

-

电子邮箱:我的是/ at / gmx / dot / de地址。


^
no

Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.


这篇关于scan:long long int的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆