社区
C++ 语言
帖子详情
error C2275:'FILE'illegal use of this type as an expression
saintmar
2009-04-14 07:39:39
error C2275: 'FILE' : illegal use of this type as an expression
code:FILE *file = _wfopen(szName, TEXT("rb"));
就这么一条代码,报这么个恶心错,大哥们帮忙看看,怎么下手处理呢?
最后的10分,晕....
...全文
3199
23
打赏
收藏
error C2275:'FILE'illegal use of this type as an expression
error C2275: 'FILE' : illegal use of this type as an expression code:FILE *file = _wfopen(szName, TEXT("rb")); 就这么一条代码,报这么个恶心错,大哥们帮忙看看,怎么下手处理呢? 最后的10分,晕....
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
23 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
ShouldBeDifferent
2012-07-25
打赏
举报
回复
16楼正解啊,解决了我的问题,谢谢。。。
好变态的纯C
dranuc07
2012-05-28
打赏
举报
回复
我是来拜谢16楼的,帮了大忙啊,今天我也遇到这个问题了,多谢多谢
[Quote=引用 16 楼 的回复:]
你定义的位置不对,纯C程序不能放在程序段中,要放在程序段头定义。
[/Quote]
forlesugar
2012-01-10
打赏
举报
回复
真的是这样。。。C还是不一般
lw1957625
2011-05-28
打赏
举报
回复
刚刚也碰到这个问题 太雷人啦~~竟然要放到程序段头定义~~
wenfh2020
2010-12-05
打赏
举报
回复
[Quote=引用 16 楼 no1_david 的回复:]
你定义的位置不对,纯C程序不能放在程序段中,要放在程序段头定义。
[/Quote]
VS 2008 真恶搞~ 搞半天我还以为哪里出问题了呢。
jiangest
2009-05-29
打赏
举报
回复
刚发完帖子,猛地想到了,16楼说的有道理,的确是要放在程序段头(也就是说,一其他关于操作的函数都必须在此定义之后)现在已经通过了。终于可以睡觉啦。
在此 也感谢16楼的兄弟!
jiangest
2009-05-29
打赏
举报
回复
我也遇到了这个问题,我的代码中,进行了两次对不同的两个文件的操作,一次是读出,一次是写入。
但是奇怪的是,如果将两个操作分离即:只读或者只写都不会报错。现在还没搞懂这到底是怎么了!
no1_david
2009-05-03
打赏
举报
回复
你定义的位置不对,纯C程序不能放在程序段中,要放在程序段头定义。
goodname
2009-04-15
打赏
举报
回复
你自定义的头文件中FILE大概被重新定义了。。。。请认真查查有没有类似
#define FILE xxx
的地方
saintmar
2009-04-15
打赏
举报
回复
[Quote=引用 12 楼 goodname 的回复:]
应该是工程设置或者也许重新定义了FILE结构什么的
_wfopen(szName, TEXT("rb"));
直接这样写,报错吗
[/Quote]
这样不报错!
Jinhao
2009-04-14
打赏
举报
回复
_tcscat(szName,TEXT("MMDic.dat"));
//////这中间没有其他的代码了吗?
//得到库文件
FILE *file = _wfopen(szName, TEXT("rb"));// <--------------报错的恶心地方
你检查一下.正代码之前,有没有少写了什么,比如) ; #endif 这些之类的.报这个错的原因就是 FILE * file 这句编译器没有把它当作声明一个file,而是 FILE 乘 file.
goodname
2009-04-14
打赏
举报
回复
应该是工程设置或者也许重新定义了FILE结构什么的
_wfopen(szName, TEXT("rb"));
直接这样写,报错吗
机智的呆呆
2009-04-14
打赏
举报
回复
FILE file = _wfopen(szName, TEXT("rb")); //这样试试
saintmar
2009-04-14
打赏
举报
回复
谢谢各位大哥,我再查查资料吧……刚才公司一个高人来现场指导也没解决。
zhangzhao123
2009-04-14
打赏
举报
回复
不太熟悉wfopen函数
saintmar
2009-04-14
打赏
举报
回复
嗯~
goodname
2009-04-14
打赏
举报
回复
觉得问题还是没有出在这些代码里面
zgjxwl
2009-04-14
打赏
举报
回复
FILE的问题?
saintmar
2009-04-14
打赏
举报
回复
Jinhao 大哥,加了头文件了,问题不在这块。
luojc714
2009-04-14
打赏
举报
回复
貌似_wfopen()的问题,szName参数的类型对吗?
加载更多回复(3)
常见C语言错误提示信息.doc
常见C语言错误提示信息
C语言常见提示信息(很全面,很经典)
适用于C语言初学者,涵盖了较多初级者容易犯的错误,欢迎大家下载
c语言出错信息汇总
c语言出错信息汇总,简单明了。
JSP Simple Examples
JSP Simple Examples Index 1. Creating a String In jsp we create a string as we does in a java. In jsp we can declare it inside the declaration directive or a scriptlet directive. String Length In java, Strings are objects that belong to class java.lang.String. A string is a sequence of simple characters. We can get the length of the string by using the method length() of java.lang.String. Declaring string array in java An array is the collection of same data
type
. Suppose if we have a declare an array of
type
String, then it will store only the String value not any other data
type
. When we have a closely related data of the same
type
and scope, it is better to declare it in an array. Multidimensional array java A two dimensional array can be thought as a grid of rows and columns. The first array will reflect to a row and the second one is column. int array Array is a collection of same data
type
. Suppose if we have declared an array of
type
int then the array will take only the int values and not any other data
type
s. We can find find out the length of the variable by using the variable length . JSP string array String array cannot hold numbers or vice- versa. Arrays can only store the
type
of data specified at the time of declaring the array variable. Custom exceptions Custom Exception inherits the properties from the Exception class. Whenever we have declare our own exceptions then we call it custom exceptions. Throwing an exception All methods
use
the throw statement to throw an exception. The throw statement requires a single argument a throwable object. Here is an example of a throw statement. Arrayindexoutofboundsexception ArrayIndexOutOfBoundException is thrown when we have to indicate that an array has been accessed with an
illegal
index. printStackTrace in jsp printStackTrace is a method of the Throwable class. By using this method we can get more information about the
error
process if we print a stack trace from the exception. Runtime
Error
s
Error
s are arised when there is any logic problem with the logic of the program. Try catch in jsp In try block we write those code which can throw exception while code execution and when the exception is thrown it is caught inside the catch block. Multiple try catch We can have more than one try/catch block. The most specific exception which can be thrown is written on the top in the catch block following by the less specific least. Nested try catch We can declare multiple try blocks inside the try block. The most specific exception which can be thrown is written on the top in the catch block following by the less specific least. kilometers per liter to miles per gallon Kilometers per liter : The distance traveled by a vehicle which is running on gasoline or diesel fuel in a kilometer. Miles per Gallon: The distance traveled by a vehicle which is running on gasoline or diesel fuel in a mile. Ascii values table ASCII stands for American Standard Code for Information Interchange. Computers can only understand numbers, so an ASCII code is the numerical representation of a character such as @, #, $, and so on. ASCII was developed when non- printing characters were rarely
use
d. life cycle of a jsp page Life of the the jsp page is just same as the servlet life cycle. After get translated the jsp
file
is just like a servlet. Page directive attributes A directive is a way to give special instructions to the container at page translation time. The page directive is written on the top of the jsp page. Html tags in jsp In this example we have
use
d the html tag inside the println() method of the out implicit object which is
use
d to write the content on the browser. Password Controls In this program we are going to know how the server determines whether the password entered by the
use
r is correct or not. This whole process is controlled on the server side. Multiple forms in jsp The form tag creates a form for
use
r input. A form can contain checkboxes, textfields, radio- buttons and many more. Forms are
use
d to pass
use
r- data to a specified URL which is specified in the action attribute of the form tag. Interface in jsp In interface none of its methods are implemented. All the methods are abstract. There is no code associated with an interface. In an interface all the instance methods are public and abstract. Interfaces are always implemented in the class. They add extra behaviors to the class. Inheritance in java with example Inheritance is one of the concept of the Object- Oriented programming. It allows you to define a general class, and later more specialized classes by simply adding some new details. Constructor inheritance Constructors are
use
d to create objects from the class. Constructor declaration are just like method declaration, except that they do not have any return
type
and they
use
the name of the class. The compiler provides us with a default constructor to the class having no arguments. Abstract classes We does not make a object of the abstract class. This class must be inherited. Unlike interface the abstract class may implement some of the methods defined in the class, but in this class at least one method should be abstract. Using Super class Variables With Sub-classed Objects One of the strong features of java is that it is follows a OOPs concept, and one of the feature of OOP in java is that, we can assign a subclass object or variable to the variable of the superclass
type
. Log
file
s Log
file
s keeps a records of internet protocol addresses (IP), Http status, date, time, bytes sent, bytes recieved, number of clicks etc. Calculate a factorial by using while loop In this example we are going to find out the factorial of 12 by using the while loop. In while loop the loop will run until the condition we have given gets true. Calculating factorial After going through this example you will be understand how you can calculate the factorial by using recursion in jsp. To make a program on factorial, firstly it must be clear what is recursion. Celsius Fahrenheit Celsius is a unit to measure temperature scale on which water freezes at 0 degree and boiling point is 100 degree. This unit is discovered by Celsius in 1742, a Swedish astronomer and physicist, he has invented the centigrade, or Celsius thermometer divided between the freezing and boiling points of water into 100 parts. comment in jsp In a jsp we should always try to
use
jsp- style comments unless you want the comments to appear in the HTML. Jsp comments are converted by the jsp engine into java comments in the source code of the servlet that implements the Jsp page. Html tag inside out implicit object In this program we are going to
use
a html tag inside a out object. out object is
use
d to display the content on the browser. To make this program run
use
out object inside which define some html code along with the content you want to display on the browser Jsp methods In this example we are going to show you how we can declare a method and how we can
use
d it. In this example we are making a method named as addNum(int i, int b) which will take two numbers as its parameters and return integer value. Multiple methods Jsp is
use
d mainly for presentation logic. In the jsp we can declare methods just like as we declare methods in java classes. Methods can be declared in either declaration directive or we can declare it in scriptlet. If we declare method inside declaration directive, then the method is applicable in the whole page. Passing Array method Array is a collection of similar data
type
. It is one of the simplest data structures. Arrays holds equally sized data elements generally of the similar data
type
. Two index In this example we will show how we can
use
two indexes in a for loop. We can solve this problem by using for loop defined inside the scriptlet directive. Date in JSP To print a Date in JSP firstly we are importing a class named java.util.Date of the package java.util. This package is imported in the jsp page so that the Date class and its properties can accessed in the JSP page. If- Else Ladder A ladder means a vertical set of steps. It is a computer generated list of pairings
use
d in eliminations. Nested If We
use
the if condition to check if the particular condition is true then it should perform a certain task, and if a particular condition is not true then it should do some other tasks. Quintessential JSP Quintessential means representing the perfect example of a class or quality. It is pure and concentrated essence of a substance. Include
File
JSP using directive and include action <%@ include
file
= " "%>: - This is include directive. This directive has only one attribute named as
file
, which is
use
d to include a
file
in the jsp page at the translation time.
:- This is known as the include standard action. This standard action is
use
d to include a
file
at run time. This standard action is evaluated at the run time. Snoop in JSP It mostly contains the request information, ServletContext initialization parameters, ServetContext attributes, request headers, response headers etc. sendRedirect In JSP sendRedirect() method is a method of HttpServletResponse interface. In sendRedirect() the object of request will be generated again with the location of page which will perform the request of the client. Request Header in JSP Whenever an http client sends a request, it sends the request in the form of get or post method or any other HttpRequest methhods. It can also sends the headers with it. Specific request headers in JSP Whenever an http client sends a request, it can also sends the headers with it. All the headers are optional except Content-length, which is required only for POST request. Java class in JSP To
use
the class inside the jsp page we need to create an object of the class by using the new operator. At last
use
the instance of the class to access the methods of the java
file
. Setting Colors in JSP In Jsp also we can set the background color which we want, the font color can be changed. The table can be coloured . By using the colors code we can give colors according to our wish. Sine Table in JSP Mathematically, the sine of an angle is the ratio of the length of the opposite side to the length of the hypoten
use
of an imaginary right triangle having that angle in it. Applet In Jsp Applets are small programs or applications written in java. These applets are those small programs that runs on web browsers, usually written in java. We can
use
the applets in jee also. In jee it runs on the context of web application on a client computer. Creating a Local Variable in JSP Consider a situation where we have to declare a variable as local, then we should declare the methods and variables in tag except the declaration directive. Method in Declaration Tag Anything which will be declared inside declaration tag will be applicable within the whole application. We call this tag a Declaration Tag. The syntax of this tag is <%! --------- %>. Forward a JSP Page The request object goes to the controller then the controller decides by which jsp or servlet this request will be processed, then the request object is passed to that jsp or servlet and the output is displayed to the browser by the response object. Random in JSP Random numbers are the numbers that are determined entirely by chance.
Use
r does not have any control over the working of random numbers. random() is a method of Math class which extends java.lang package. JSP include directive By using the include tag the
file
will be included in the jsp page at the translation time. In this example we have created a jsp
file
which has to be included in the other jsp
file
by using the tag <%@ include
file
= " "%>. Literals in JSP Literals are the values, such as a number or a text string, that are written literally as part of a program code. A literal is a
expression
of a value, including a number or a text string. Passing Parameter using
Request parameters can be passed by using
. This tag contains two attributes: 1) name 2) value. Tag Handler Custom tags are usually distributed in the form of a tag library, which defines a set of related custom tags and contains the objects that implement the tags. Custom tag libraries allow the java programmer to write code that provides data access and other services, and they make those features available to the jsp author in a simple to
use
XML- like fashion.
Use
Bean Syntax:
useBean id= "nameOfInstance" scope= "page | request | session | application" class= "package.class"
type
= "package.class >
useBean>.
Expression
Language In JSP EL means the
expression
language , it is a simple language for accessing data, it makes it possible to easily access application data stored in JavaBeans components. EL Basic Arithmetic Addition (+), subtraction (-), multiplication (*), division (/ or div), and modulus (% or mod) are all supported in
Expression
Language.
Error
conditions, like division by zero are handled easily by the
expression
language.
C语言常见错误信息
下面列出的是一些常见的出错信息,其中包括编译、连接和运行时的错误及警告提示信息。 Argument list syntax
error
参数表语法错误 Argument 1 missing name参数1漏了名字(只写了类型) Array bounds missing漏掉了数组的界限符‘[’或‘]’ Array size too large数组长度太大 Bad character in parameters参数中含有不合适的字符 Bad
file
name format in include directive包含命令中文件名格式不正确 Call of non function 调用未定义的函数 Call to function with no proto
type
调用函数时没有声明函数原型 Cannot modify a const object不允许修改常量对象 Case outside of switch case超出了switch语句的范围
C++ 语言
65,083
社区成员
250,537
社区内容
发帖
与我相关
我的任务
C++ 语言
C++ 语言相关问题讨论,技术干货分享,前沿动态等
复制链接
扫一扫
分享
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
请不要发布与C++技术无关的贴子
请不要发布与技术无关的招聘、广告的帖子
请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下
试试用AI创作助手写篇文章吧
+ 用AI写文章