文件复制小问题
#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>
int main(void)
{
FILE *file_sou,*file_typ;
char ch,name_sou[20],name_typ[20];
printf("Please enter the source file:\n");
gets(name_sou);
printf("Please enter the copy file:\n");
gets(name_typ);
if((file_sou=fopen(name_sou,"r"))==NULL)
{
printf("Can't open the file %s.\n",name_sou);
exit(1);
}
if((file_typ=fopen(name_typ,"r"))==NULL)
{
printf("Can't open the file %s.\n",name_typ);
exit(2);
}
while(ch=getc(file_sou))
if(toupper(ch))
putc(ch,name_typ);
fclose(file_sou);
fclose(file_typ);
return 0;
}
D:\13章\练习3\1.cpp(27) : error C2227: left of '->_cnt' must point to class/struct/union
D:\13章\练习3\1.cpp(27) : error C2227: left of '->_ptr' must point to class/struct/union
D:\13章\练习3\1.cpp(27) : error C2664: '_flsbuf' : cannot convert parameter 2 from 'char [20]' to 'struct _iobuf *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
执行 cl.exe 时出错.
1.obj - 1 error(s), 0 warning(s)