PTT
Submit
Submit
選擇語言
正體中文
简体中文
PTT
Marginalman
[閒聊] 我可以再問一個寫程式的問題嗎
作者:
Wardyal
(Wardyal)
2023-11-01 14:11:58
為什麼我
FILE *fp;
int tmp = 1;
fopen(fp, "test.txt", "w");
fprintf(fp, "%s\n", "apple");
fprintf(fp, "%d", tmp);
fclose(fp);
都會在fprintf %s 那行Segmentation Fault阿
就算後來換成
char *str = "apple";
也是一樣 好怪
作者:
walter741225
(瓦特)
2023-11-01 14:13:00
你是不是應該先檢查fopen的結果一般都會寫判斷式確定open成功
作者:
Wardyal
(Wardyal)
2023-11-01 14:15:00
可是我測了很多次 都還是不行 我其他地方fprint int都沒問題主要是就算判斷失敗 我還是要寫 所以我就沒寫判斷了:0
作者:
WindowDragon
(貼貼)
2023-11-01 14:19:00
竟然能在這種文看到特 我流淚了
作者:
kerycheng
(kk)
2023-11-01 14:26:00
fopen只有給兩個輸入值吧FILE *fopen(const char *filename, const char *mode)
繼續閱讀
[BGD ] 買夠開獎
b77889999
[閒聊] 我最欣賞的遊戲YT
HidekiRyuga
[BGD] 開票了
Chiitan
每一口都幾十億的濃稠白色液體
oz5566
Re: 台V募款到八百萬買造型
SAKIASHIZAWA
Re: [閒聊] 程式語言廚
Neuenmuller
[姆咪] 好想討個老婆
takashi001
啟英高中同班情侶被前男友出賣
ken890126
[閒聊] x碗x寶
bigbowl
[姆咪] 我朋友都有小孩了
takashi001
Links
booklink
Contact Us: admin [ a t ] ucptt.com