C++ c创建txt文件

来源:互联网 发布:sql数据库设计工具 编辑:程序博客网 时间:2024/05/01 14:59
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
 int a[10];
 ofstream outfile("abc.txt",ios::out);
 if (!outfile)
 {
  cerr<<"open error"<<endl;
  exit(1);
 }
 outfile<<"你好,欢迎你来到C++的世界"<<endl;
 outfile.close();
 
 return 0;
}
0 0