| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1193 人关注过本帖
标题:关于[...]这个转换字符求实例
只看楼主 加入收藏
davidguhao
Rank: 1
来 自:广东
等 级:新手上路
帖 子:126
专家分:7
注 册:2016-7-18
结帖率:89.47%
收藏
 问题点数:0 回复次数:6 
关于[...]这个转换字符求实例
如题……
2016-08-11 16:47
davidguhao
Rank: 1
来 自:广东
等 级:新手上路
帖 子:126
专家分:7
注 册:2016-7-18
收藏
得分:0 
是用在scanf中的……书中只讲了[^...]的实例……这个不懂了

暨南大学市场营销……
但是我有一颗计算机专业的心……
2016-08-11 16:48
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9031
专家分:54061
注 册:2011-1-18
收藏
得分:0 
惜字如金呀,没看懂你的问题,只能将相应的标准描述全贴给你
[
Matches a nonempty sequence of characters from a set of expected characters.

If no l length modifier is present, the corresponding argument shall be a pointer to the initial element of a character array large enough to accept the sequence and a terminating null character, which will be added automatically.

If an l length modifier is present, the input shall be a sequence of multibyte characters that begins in the initial shift state. Each multibyte character is converted to a wide character as if by a call to the mbrtowc function, with the conversion state described by an mbstate_t object initialized to zero before the first multibyte character is converted. The corresponding argument shall be a pointer to the initial element of an array ofwchar_t large enough to accept the sequence and the terminating null wide character, which will be added automatically.

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. If the conversion specifier begins with []or[^], the right bracket character is in the scanlist and the next following right bracket character is the matching right bracket that ends the specification; otherwise the first following right bracket character is the one that ends the specification. If a-character is in the scanlist and is not the first, nor the second where the first character is a^, nor the last character, the behavior is implementation-defined.

2016-08-12 09:08
砖家的谎言
Rank: 12Rank: 12Rank: 12
等 级:禁止访问
威 望:30
帖 子:693
专家分:3898
注 册:2013-12-6
收藏
得分:0 
我也不知道你想要干嘛的

我不是砖家,要努力成为砖家。
2016-08-12 09:30
davidguhao
Rank: 1
来 自:广东
等 级:新手上路
帖 子:126
专家分:7
注 册:2016-7-18
收藏
得分:0 
回复 3楼 rjsp
版主大神啊……小弟下学期才上大一……真心有点搞不定这英文了……
char *a;
a = malloc(100);
scanf("[^ ]", a);
我就搞明白了这个就是说将用户输入的数据中空格以前的一切存储到指针a指向的地址中
可是他的兄弟这个【】没弄懂怎么搞……

暨南大学市场营销……
但是我有一颗计算机专业的心……
2016-08-14 09:27
linlulu001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:20
帖 子:944
专家分:4047
注 册:2016-4-13
收藏
得分:0 
https://bbs.bccn.net/thread-466562-1-1.html
我总结的,自己去看。里面有你要的答案
2016-08-14 12:16
davidguhao
Rank: 1
来 自:广东
等 级:新手上路
帖 子:126
专家分:7
注 册:2016-7-18
收藏
得分:0 
回复 6楼 linlulu001
十分感谢!

暨南大学市场营销……
但是我有一颗计算机专业的心……
2016-08-15 11:48
快速回复:关于[...]这个转换字符求实例
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027210 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved