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 閱讀(172)
評論(0) 編輯 收藏 引用 所屬分類:
學習筆記