社区
工具平台和程序库
帖子详情
菜鸟问题
混混谔谔的十年
2003-12-03 11:05:21
#include "stdafx.h"
#include "download.h"
#include "fstream.h"
#include <vector>
using namespace std;
int main()
{
ifstream in("d:\\temp.txt");
in.seekg(1,ios::beg);
cout << in.rdbuf() << endl;
return 0;
}
在vc6下编译,却说ifstream 有二义性,请问为甚么,如何解决
...全文
52
12
打赏
收藏
菜鸟问题
#include "stdafx.h" #include "download.h" #include "fstream.h" #include using namespace std; int main() { ifstream in("d:\\temp.txt"); in.seekg(1,ios::beg); cout << in.rdbuf() << endl; return 0; } 在vc6下编译,却说ifstream 有二义性,请问为甚么,如何解决
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
12 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
fierygnu
2003-12-03
打赏
举报
回复
1、vector中包含了其他头文件,其中有ifstream的定义,是定义在std名字空间的。
2、#include "fstream.h"中定义了ifstream,定义在缺省的名字空间。
3、用了using namespace std后,两个ifstream就有了二义性。
ambition2005
2003-12-03
打赏
举报
回复
#include <fstream>
#include <vector>
#include<iostream>
using namespace std;
int main()
{
ifstream in("d:\\temp.txt");
in.seekg(1,ios::beg);
cout << in.rdbuf() << endl;
return 0;
}
这样些就对,那为什么楼主的那个会有二义性呢?
leyt
2003-12-03
打赏
举报
回复
#include "stdafx.h"
#include "download.h"
#include <fstream>
#include <vector>
using namespace std;
int main()
{
ifstream in("d:\\temp.txt");
in.seekg(1,ios::beg);
cout << in.rdbuf() << endl;
return 0;
}
heguobaoceo
2003-12-03
打赏
举报
回复
#include <fstream>
#include <vector>
#include<iostream>
using namespace std;
int main()
{
ifstream in("d:\\temp.txt");
in.seekg(1,ios::beg);
cout << in.rdbuf() << endl;
return 0;
}
liem
2003-12-03
打赏
举报
回复
仅从现在的程序来看,也可以去掉using namespace std;这一句。估计是在namespace std中对ifstream也有定义。
如果用#include <fstream>,还要加入#include <iostream>否则cout不能用。当然此时要用using namespace std;
heguobaoceo
2003-12-03
打赏
举报
回复
是咯
<fstream>是库函数
你不应该定义为"fstrema.h";
我发现好多的人都出现这中问题咯
thuers
2003-12-03
打赏
举报
回复
对
hanyixin
2003-12-03
打赏
举报
回复
当然了,也要 using namespace std;
hanyixin
2003-12-03
打赏
举报
回复
用:
#include <fstream>
就可以了。
bluesmile979
2003-12-03
打赏
举报
回复
#include <fstream>
Rossonero
2003-12-03
打赏
举报
回复
我刚开始看C++,就留了个fstream.h,在vc6下无任何问题.
//#include "stdafx.h"
//#include "download.h"
#include "fstream.h"
//#include <vector>
//using namespace std;
int main()
{
ifstream in("d:\\temp.txt");
in.seekg(1,ios::beg);
cout << in.rdbuf() << endl;
return 0;
}
mufengqing
2003-12-03
打赏
举报
回复
扫嘎
程序员的十个层次(不得不看)
中国的程序员水平比西方程序员水平差,还是中国有许多优秀的程序员达到或超过了西方程序员同等水平呢?要解决这个
问题
,必须先知道程序员有多少种技术层级,每个层级需要什么样的技术水平,然后再比较中国和西方在各个技术层级的人数,就可以知道到底有没有差距,差距有多大。
Laravel
菜鸟
上路 - 踩坑 -
菜鸟
问题
1 - 配置文件.env 并非实时生效
Laravel
菜鸟
上路 - 踩坑 -
菜鸟
问题
1 - 配置文件.env 并非实时生效
问题
: rt 解决: php artisan config:cache 过程: 非常之痛苦……反复修改各种尝试, nnd新的数据库配置就是更新不上去, 访问的永远是第一次初始化配置的默认数据库, 看了官方英文原文的配置文件一个角落里面的一句话后尝试,后解决;
extern 报错【error c2146】
菜鸟
问题
error C2146: syntax error : missing ';' before identifier 'g_var' 在a.cpp中定义 CXX g_var; 在b.cpp中用extern CXX g_var; 报错。 g_var前面的类型无法识别,这种
菜鸟
问题
,原来是应该在用extern CXX g_var; 之前,将CXX的声明告诉编译器。 不要忽视这些小
问题
。
控件的Group属性 一个
菜鸟
问题
MFC高手进来
请问控件的Group属性 一个
菜鸟
问题
MFC高手进来 检举|2009-03-12 21:49JavaTarcies | 分类:VC++ | 浏览1944次 这个Group属性貌似和Tap顺序有关 其他我就不懂了 请问 选择TRUE和选择FALSE 的区别是什么 请高手通俗的说说 我有更好的答案 提问者采纳 2009-03-13 14:22 1、一个group没有特定的名字,是由系统
c语言
菜鸟
(C语言
菜鸟
工具)
小弟新学C语言在此问一个C语言的
菜鸟
问题
啊在C语言中能否不用第三? 对于数值型变量x与y: x=x+y y=x-y x=x-y 我想请教C语言几个超级
菜鸟
的
问题
请问C语言的粘贴,复制语句的快捷 在 TC2里是先定义块(象WPS 16位的老版本),用 CTRL+K+B定义块首,CTRL+K+K定...
工具平台和程序库
24,854
社区成员
27,330
社区内容
发帖
与我相关
我的任务
工具平台和程序库
C/C++ 工具平台和程序库
复制链接
扫一扫
分享
社区描述
C/C++ 工具平台和程序库
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章