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;
}
#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;
}
相关文章推荐
- 指针动态,分布与列表
- 用c++写一个 “hello,world” 的 FastCGI程序
- 彭界博-个人公寓管理系统
- C++ new/delete运算符
- C++ STL中哈希表 hash_map介绍
- ubuntu安装c/c++开发环境
- C++ num++书写位置影响其值的输出问题
- c++中 static修饰修饰类声明部分
- c++多项式计算器
- [C++ && Python]简单模拟代码评测系统
- 150809234 赵帅 (宿舍管理系统)2
- C/C++中的switch使用
- C++ 设置基类的析构函数为虚函数
- 关于C语言的指针、链表的原理和各类操作
- C++ 相关知识总结
- C语言编程---socket基础
- C语言中的预处理详解
- SM2算法第十三篇:SM2密钥协商协议的C语言实现
- C语言程序设计飞机游戏的体会
- C++ primerplus 第12章课本上例题