[新人求助]:关于读文件写文件的程序,到底错在哪里啊???????
关于读文件写文件的程序,到底错在哪里啊!
#include <stdio.h>
main()
{
FILE *fp;
char ch,filename[10];
scanf("%s",filename);
if((fp=fopen(filename,"w"))==NULL)
{
printf("cannot open file\n");
exit(0);
}
ch=getchar();
while(ch!='#')
{
fputc(ch,fp);
putchar(ch);
ch=getchar();
}
fclose(fp);
}
我在vc++里面运行报错如下:
--------------------Configuration: std - Win32 Debug--------------------
Linking...
exam12_1.obj : error LNK2005: _main already defined in aaa.obj
reverse.obj : error LNK2005: _main already defined in aaa.obj
test.obj : error LNK2005: _main already defined in aaa.obj
aaa.obj : error LNK2001: unresolved external symbol _textbackground
Debug/std.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
[此贴子已经被作者于2006-4-6 9:46:58编辑过]