推 petingo: google c 讀欓 不就一堆了嗎= =? 12/20 23:45
當然拉 找的到一堆 但沒有我要的阿 我要的是用字串 有沒有可已取代gets的東西
不要用cin
※ 編輯: TIANPJ (123.205.125.228), 12/20/2015 23:50:57
→ grayStone: cin : QQ 12/20 23:53
→ alex70266: c fileio 12/21 00:04
→ jaid: 這明明是C.. 12/21 00:10
FILE *f1=fopen("a.txt","r");
fgets(f1,m);
fscanf(f1,"%c %c",&a,&b);
這樣不對 9 D:\成檢練習\test11.cpp cannot convert `FILE*' to `char*' for argument `1'
to `char* fgets(char*, int, FILE*)' 如何解讀阿
※ 編輯: TIANPJ (123.205.125.228), 12/21/2015 00:25:08
搞錯用法了 fgets(m,20,f1); 這樣就對了 謝謝大家 特別謝謝alex70226
※ 編輯: TIANPJ (123.205.125.228), 12/21/2015 00:29:42
→ overhead: 同學 請至少先google fgets怎麼用 你連引數的數量都錯了 12/21 00:30
→ overhead: 恭喜 12/21 00:30
→ Caesar08: 你知道你在寫c code,卻問c++ code嗎? 12/21 09:57
→ BlazarArc: 這明明是C 12/21 11:35
推 idiont: 借問一下 用freopen不是比fopen更簡單嗎 12/21 23:05
推 LPH66: 如果你只讀一個檔而且只讀檔不讀鍵盤輸入那就可以 freopen 12/22 00:28
→ LPH66: 再說 freopen stdin 其實不是個好做法 12/22 00:29