[問題] fgets讀檔同時strtok分隔後儲存
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
GCC
問題(Question):
在迴圈裡fgets,再strtok分割後儲存、印出結果正確
但是出迴圈再印資料會損失
餵入的資料(Input):
input.txt
1,Tammy J. Connors,TammyJConnors@teleworm.us,580-228-1482
2,Lewis S. Archer,LewisSArcher@teleworm.us,904-305-6505
預期的正確結果(Expected Output):
1,Tammy J. Connors,TammyJConnors@teleworm.us,580-228-1482
2,Lewis S. Archer,LewisSArcher@teleworm.us,904-305-6505
錯誤結果(Wrong Output):
1,Lewis S. Archer,ewisSArcher@teleworm.us,4-305-6505
2,Lewis S. Archer,LewisSarcher@teleworm.us,904-3056505
0,<null>,<null>,<null>
程式碼(Code):(請善用置底文網頁, 記得排版)
http://pastie.org/5564492
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.221.54
推
12/22 16:49, , 1F
12/22 16:49, 1F
原來如此 了解 我再試試看別的方法..
※ 編輯: kids1243 來自: 140.114.221.54 (12/22 16:54)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章