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()函數(shù)接收輸入數(shù)據(jù)時(shí),遇以下情況結(jié)束一個(gè)數(shù)據(jù)的輸入
① 遇空格、“回車”、“跳格”鍵。
② 遇寬度結(jié)束。
③ 遇非法輸入。
關(guān)于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
就是返回的是正確讀入的數(shù)據(jù)的個(gè)數(shù)
posted on 2007-07-18 00:07
yoyouhappy 閱讀(173)
評論(0) 編輯 收藏 引用 所屬分類:
學(xué)習(xí)筆記