|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 quiet小朋友 于 2012-4-14 16:39 编辑
一代码:
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- FILE *fp;
- fp = fopen("noexist","rb");
- fprintf(fp,"aa");
- if(fp==NULL) return;
- fclose(fp);
- }
复制代码 编译成功,可加了以下语句就不行:
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- int a;
- a = 3;
- FILE *fp;
- fp = fopen("noexist","rb");
- fprintf(fp,"aa");
- if(fp==NULL) return;
- fclose(fp);
- }
复制代码 编译器提示:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
small.c
d:\我的文档\桌面\small.c(7) : error C2275: 'FILE' : illegal use of this type as an expression
C:\Program Files\Microsoft Visual Studio\VC98\include\stdio.h(156) : see declaration of 'FIL
E'
d:\我的文档\桌面\small.c(7) : error C2065: 'fp' : undeclared identifier
d:\我的文档\桌面\small.c(8) : warning C4047: '=' : 'int ' differs in levels of indirection from 'str
uct _iobuf *'
d:\我的文档\桌面\small.c(9) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of ind
irection from 'int '
d:\我的文档\桌面\small.c(9) : warning C4024: 'fprintf' : different types for formal and actual param
eter 1
d:\我的文档\桌面\small.c(10) : warning C4047: '==' : 'int ' differs in levels of indirection from 'v
oid *'
d:\我的文档\桌面\small.c(11) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of in
direction from 'int '
d:\我的文档\桌面\small.c(11) : warning C4024: 'fclose' : different types for formal and actual param
eter 1
请按任意键继续. . .
只加了"int a; a = 3;"这句话,怎么就不行了?
(我试过,其他代码也是这样):'(:Q
|
|