c++创建txt文件,并写入内容
2016-04-11 17:49
543 查看
参考链接: /article/2319277.html
参考链接: http://www.weixueyuan.net/view/5825.html
参考链接: /article/5931334.html
参考链接: /article/3587425.html
以上大神解释的非常详细和全面,很多暂时用不到的就不列了,以下是自己的应用
参考链接: http://www.weixueyuan.net/view/5825.html
参考链接: /article/5931334.html
参考链接: /article/3587425.html
以上大神解释的非常详细和全面,很多暂时用不到的就不列了,以下是自己的应用
#include <fstream> #include <iostream> #incldue <string> int main() { ofstream location_out; string ss; ss = “(1, 2)”; location_out.open("location_out.txt", std::ios::out | std::ios::app); //以写入和在文件末尾添加的方式打开.txt文件,没有的话就创建该文件。 if (!location_out.is_open()) return 0; location_out << ss << endl; location_out <<“(”<< 5 << “,” << 10 << “) \n” ; //将”(5,10) 回车”写入.txt文件中 location_out.close(); }
相关文章推荐
- C++作业3—本月有几天/定期存款利息计算器/个人所得税计算器
- c++标准模板库_联合容器_Bitsets详解
- c++标准模板库_容器适配器 _Queues(队列)详解
- c++标准模板库_容器适配器 _Stacks(堆栈)详解
- c++标准模板库_顺序结构_List详解
- c++标准模板库_顺序结构_Vectors详解
- c++迭代器Iterator详解
- c++指针详解
- c++实验3-个人所得税计算器
- c++快速简易入门教程_006继承
- cpptest 的安装和破解
- 已知三点坐标求外接圆方程和RANSAC算法的介绍,用C语言实现,其使用随机抽样一致性算法来求最合适圆时使用
- c++快速简易入门教程_005this指针
- c++快速简易入门教程_004函数的重载
- c++快速简易入门教程_003析构函数
- c++快速简易入门教程_002构造函数
- c++快速简易入门教程_001从结构体到类
- 深入理解C++中函数参数——传值与传址详解
- 初识C++之继承
- C++基本语法-----vector和list