这个是怎么回事inflie' uses undefined class 'basic_ifstream

C_neiae 2009-12-25 05:49:45
int filein(char a[],int &num)//从文件中读数据
{
int i;
ifstream inflie("f1.txt",ios::in);
if(!inflie)
{
cout<<"ERROR!"<<endl;
return 1;
}
i=0;

while(!inflie.eof())
{
inflie>>a[i];
cout<<a[i]<<" ";
i++;
}
num=i+1;//字符的个数
cout<<endl;
inflie.close();
return 0;
}
出错:
error C2079: 'inflie' uses undefined class 'basic_ifstream<char,struct std::char_traits<char> >'
...全文
664 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
shen_wei 2012-07-24
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 的回复:]
用#include <fstream>
需要using namespace std;
[/Quote]

三年了的帖子了。。
yang191559967 2012-07-24
  • 打赏
  • 举报
回复
三楼正解!
pur_e 2009-12-25
  • 打赏
  • 举报
回复
用#include <fstream>
需要using namespace std;
sms88 2009-12-25
  • 打赏
  • 举报
回复
没头文件吧 ?
pur_e 2009-12-25
  • 打赏
  • 举报
回复
引入头文件了?

15,440

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧