读书人

高手看看这段小程序的异常.

发布时间: 2012-02-28 13:06:35 作者: rapoo

高手看看这段小程序的错误....
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream myfile( "c:\\1.txt ",ios::out|ios::trunc,0);
myfile < < "中国软件开发实验室 " < <endl < < "网址: " < < "www.cndev-lab.com ";
myfile.close();
system( "pause ");
return 0;
}
CSDN 一BLOG上拷的,编译出错,不知道是什么错误

error C2661: 'basic_ofstream <char,struct std::char_traits <char> > ::basic_ofstream <char,struct std::char_traits <char> > ' : no overloaded function takes 3 parameters

没这个重载函数么?? 该怎么改???我有1.TXT这个文件啊



[解决办法]
ofstream myfile( "c:\\1.txt ",ios::out|ios::trunc);
[解决办法]
那是unix/linux下才有的东西。

读书人网 >C++

热点推荐