[問題] 有關fwrite()函數輸入中、英文一問??

看板C_and_CPP (C/C++)作者 (千里之外)時間14年前 (2011/10/11 18:49), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) dev-c 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 先定義一個 char str[20]、設定好檔案指標fptr; 若要寫入這個檔案n bytes,如下程式... fwrite(str,sizeof(char),n,fptr); 書上說明: 使用sizeof(char)是因為寫入字元,可增加可讀性,當然也可以寫1; 即然一次是1個byte寫入...當輸入中文時...為何不會變亂碼寫入呢?? 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.46.117.178

10/11 19:11, , 1F
你少想了n ...
10/11 19:11, 1F
文章代碼(AID): #1Eb1z9FU (C_and_CPP)
文章代碼(AID): #1Eb1z9FU (C_and_CPP)