当我从一个文件复制到另一个文件时,执行的时候出现错误
说main函数已经定义了,
文件1
#include "stdio.h"
#include "stdlib.h"
#define NULL 0
main()
{
FILE *fp1, *fp2;
char ch;
if((fp1=fopen("txt","r"))==NULL)
{
printf("open error!");
exit(0);
}
if((fp2=fopen("txt2","w"))==NULL)
{
printf("open error!");
exit(0);
}
while(!feof(fp1))
{
ch=fgetc(fp1);
fputc(ch,fp2);
}
fclose(fp1);
fclose(fp2);
}
文件2
#include "stdio.h"
#include "stdlib.h"
#define NULL 0
int main()
{
FILE *fp1, *fp2;
char ch;
if((fp1=fopen("txt","r"))==NULL)
{
printf("open error!");
exit(0);
}
if((fp2=fopen("txt2","w"))==NULL)
{
printf("open error!");
exit(0);
}
while(!feof(fp1))
{
ch=fgetc(fp1);
fputc(ch,fp2);
}
fclose(fp1);
fclose(fp2);
return 0;
}
错误如下
-----------------Configuration: 文件1 - Win32 Debug--------------------
Linking...
文件2.obj : error LNK2005: _main already defined in 文件1.obj
Debug/文件1.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.
文件1.exe - 1 error(s), 0 warning(s)
还有怎么在windows xp下查看读到磁盘中的信息啊,我用cmd进入后,输入c>type txt后说不是命令提示符