[問題] Core Dumped...囧
看板C_and_CPP (C/C++)作者zptdaniel (忠言本逆耳,實願君向善.)時間16年前 (2009/09/04 01:09)推噓2(2推 0噓 8→)留言10則, 6人參與討論串1/1
同樣的code 在 dev-C++下可以順利執行
在unix下面產生core dumped...囧
再請高手幫幫忙了..感恩
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
FILE *fp,*fo;
fp = fopen("in.txt","w+");
fo = fopen("out.txt","w");
char *str1;
int tag;
fprintf(fp,"HelloWorld!\n");
fprintf(fp,"ILoveComputerScience!\n");
rewind(fp);
while(fscanf(fp,"%s",str1)!=EOF)
{
tag=strlen(str1);
tag--;
for(;tag>=0;tag--)
fprintf(fo,"%c",str1[tag]);
fprintf(fo,"\n");
}
fclose(fp);
fclose(fo);
system("pause");
return 0;
}
--
這流浪的人,努力讓夢成真。
That's the way I live, that's the way I did.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.194.100.216
※ 編輯: zptdaniel 來自: 123.194.100.216 (09/04 01:14)
※ 編輯: zptdaniel 來自: 123.194.100.216 (09/04 01:14)
※ 編輯: zptdaniel 來自: 123.194.100.216 (09/04 01:23)
→
09/04 01:39, , 1F
09/04 01:39, 1F
→
09/04 01:40, , 2F
09/04 01:40, 2F
推
09/04 02:29, , 3F
09/04 02:29, 3F
推
09/04 02:39, , 4F
09/04 02:39, 4F
→
09/04 02:39, , 5F
09/04 02:39, 5F
→
09/04 02:40, , 6F
09/04 02:40, 6F
→
09/04 08:43, , 7F
09/04 08:43, 7F
→
09/04 08:45, , 8F
09/04 08:45, 8F
→
09/04 12:26, , 9F
09/04 12:26, 9F
→
09/04 14:00, , 10F
09/04 14:00, 10F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章