c++ - a是多个字符和空格时,fscanf (fp,"%d",&a)调用之后,fp指针位置跳过空格吗?
PHP中文网
PHP中文网 2017-04-17 15:04:03
0
1
795

比如

fp内容:"how are you";

fscanf (fp,"%d",&a);
fscanf (fp,"%d",&b);

a输出how
b输出are吗?
为什么第二次调用fscanf自动跳过空格?

PHP中文网
PHP中文网

认证高级PHP讲师

全部回复(1)
黄舟

Whitespace character: the function will read and ignore any whitespace characters encountered before the next non-whitespace character (whitespace characters include spaces, newline and tab characters -- see isspace). A single whitespace in the format string validates any quantity of whitespace characters extracted from the stream (including none).
http://www.cplusplus.com/refe...

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!