#include
#include
#include
using namespace std;
int main()
{
ostream outfile("1.dat",ios::out|ios::in);
if(!outfile)
cout<<"open error!"<
cout<<"open succeed!"<
return 0;
}
编译后的错误是这样的:
错误1error C2664: “std::basic_ostream<_Elem,_Traits>::basic_ostream(std::basic_streambuf<_Elem,_Traits> *,bool)”: 不能将参数 1 从“const char [6]”转换为“std::basic_streambuf<_Elem,_Traits> *”h:\c++\test-13\test-13\test-13-2.cpp71test-13
然后我试着把项目的字符集从unicode改为多字符集,还是会出现相同的错误,接着又改了一下源程序,添加了tchar.h头文件:
#include
#include
#include
#include
using namespace std;
int main()
{
ostream outfile(_T("1.dat"),ios::out|ios::in);
if(!outfile)
cout<<"open error!"<
cout<<"open succeed!"<
return 0;
}
可是还是出现相同的问题,我崩溃了,求大神解决!