文件没有的话会自己创建的
两种实现方法,一种c++实现方法,一种c的实现方法
#include<iostream>
#include<sstream>
#include<fstream>
using namespace std;
int main()
{
int a = 5;
wstring aa = "adadad";
//第一种方法 c++
ofstream fout("D:\\outtxt.txt");
fout<<a<<endl;
fout<<endl;
fout<<flush;
fout.close();
//第二种方法 c
FILE *fp = fopen("d:\\out.txt", "wt");
fprintf(fp, "%d\t", a);
fprintf(fp, "\n");
fprintf(fp, "%s", aa.c_str());
fclose(fp);
system("pause");
return 0;
}