int scanf( const char *format [,argument]... );
A return value of 0 indicates that no fields were assigned. The return
value is EOF for an error or if the end-of-file character or the
end-of-string character is encountered in the first attempt to read a
character.
scanf()函数接收输入数据时,遇以下情况结束一个数据的输入
① 遇空格、“回车”、“跳格”键。
② 遇宽度结束。
③ 遇非法输入。
关于scanf的返回值,
MSDN:
Both scanf and wscanf return the number of fields successfully converted
and assigned; the return value does not include fields that were read but
not assigned. A return value of 0 indicates that no fields were assigned.
The return value is EOF for an error or if the end-of-file character or the
end-of-string character is nocountered in the first attempt to read a character
就是返回的是正确读入的数据的个数
posted on 2007-07-18 00:07
yoyouhappy 阅读(170)
评论(0) 编辑 收藏 引用 所属分类:
学习笔记