加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

d [^特定者在C

发布时间:2020-12-16 03:33:30 所属栏目:百科 来源:网络整理
导读:sscanf(line,"%d %64[^n",seconds,message); d [^表示 – 最多64个字符? 它应该与GNU C编译器一起使用吗? 解决方法 这意味着“最多可读取64个字符或在到达换行符时停止,以先到者为准”.它由标准指定,因此所有标准库都必须支持它. C11 7.21.6.2 [ Matches
sscanf(line,"%d %64[^n",&seconds,message);

d [^表示 – 最多64个字符?
它应该与GNU C编译器一起使用吗?

解决方法

这意味着“最多可读取64个字符或在到达换行符时停止,以先到者为准”.它由标准指定,因此所有标准库都必须支持它.

C11 7.21.6.2

[ Matches a nonempty sequence of characters from a set of expected
characters (the scanset).
[…]
The conversion specifier includes all subsequent characters in the
format string,up to and including the matching right bracket (]).

The characters between the brackets (the scanlist) compose the
scanset,unless the character after the left bracket is a circumflex
(^),in which case the scanset contains all characters that do not
appear in the scanlist
between the circumflex and the right bracket.

如评论中所述,可能需要匹配]来划分扫描列表.不需要s说明符.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读