#include stdio.h
main()
{file *fp;
char ch,filename[10];
scanf("%s",filename);
if ((fp=fopen(filename,"w"))==null)
{printf("can not open\n");
exit(0);}
ch=getchar();
ch=getchar();
while(ch!='#')
fputc(ch,fp);putchar(ch);
ch=getchar();
fclose(fp);
汇编时,一点的法式没想到那么多错误
Compiling...
nihao.c
f:\nihao.c(3) : error C2065: 'file' : undeclared identifier
f:\nihao.c(3) : error C2065: 'fp' : undeclared identifier
f:\nihao.c(3) : warning C4552: '*' : operator has no effect; expected operator with side-effect
f:\nihao.c(4) : error C2143: syntax error : missing ';' before 'type'
f:\nihao.c(5) : error C2065: 'filename' : undeclared identifier
f:\nihao.c(6) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
f:\nihao.c(6) : warning C4024: 'fopen' : different types for formal and actual parameter 1
f:\nihao.c(6) : warning C4047: '=' : 'int ' differs in levels of indirection from 'struct _iobuf *'
f:\nihao.c(6) : error C2065: 'null' : undeclared identifier
f:\nihao.c(8) : warning C4013: 'exit' undefined; assuming extern returning int
f:\nihao.c(9) : error C2065: 'ch' : undeclared identifier
f:\nihao.c(13) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
f:\nihao.c(13) : warning C4024: 'fputc' : different types for formal and actual parameter 2
f:\nihao.c(16) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
f:\nihao.c(16) : warning C4024: 'fclose' : different types for formal and actual parameter 1
并且死机 了