您的位置:首页 > 编程语言 > C语言/C++

C++ 生成写入字符

2016-05-18 14:49 465 查看
#include "stdafx.h"

#include <iostream>

#include <fstream>

#include <string>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

char *pPath = "D:\ds";

char *Q = "多大";

char *W = "的地";

char *E = "二人";

//char *R =Q;

//strcat(R,".TXT");

//sprintf(pPath, "%d.txt","的的");

//sprintf_s( pPath,sizeof(Q+W+E+R) "%d%d%d%d.txt",Q,W,E,R);

string TPath = "D:\\ds\\";

string WPath = "多大";

string YPath = ".txt";

string PPath = TPath + WPath + YPath;

char *A = "AAAAAAAfd反动的股份蛋糕豆腐干房贷该罚的改动个蛋糕第三个的发给蛋糕蛋糕豆腐干地方改动个搜狗贵妇狗适当方式发到斯蒂芬A";

ofstream ttfile(PPath ,ios::out); //example.txt是你要输出的文件的名字

if(!ttfile)

{

cout<<"error !";

}

else

{

ttfile<<"My first out! O(∩_∩)O~"<<'\n';

ttfile<<"2222222222222222222222~"<<'\n';

ttfile.write(A,strlen(A));

ttfile.close();

}

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: