put()函数把数据顺序写入文件
2015-09-29 16:55
211 查看
#include<fstream>
#include <iostream>
using namespace std;
int main()
{
char *str="http://www.ok2002.com";
ofstream rs;
rs.open("c:\\file3.txt",ios::out);
if(!rs)
{
cout<<"file3.txt文件没有打开!"<<endl;
return 0;
}
for(int i=0;str[i]!='\0';i++)
rs.put(str[i]);
rs.close();
return 0;
}
转自: http://www.ok2002.com/
#include <iostream>
using namespace std;
int main()
{
char *str="http://www.ok2002.com";
ofstream rs;
rs.open("c:\\file3.txt",ios::out);
if(!rs)
{
cout<<"file3.txt文件没有打开!"<<endl;
return 0;
}
for(int i=0;str[i]!='\0';i++)
rs.put(str[i]);
rs.close();
return 0;
}
转自: http://www.ok2002.com/
相关文章推荐
- 数组内容为随机1~7,不重复
- 40亿个非负整数中找到没出现的数
- CRC校验之模2除法(学习笔记、备忘)
- MongoDB使用中的一些问题
- 学习笔记:发现一个IE版本判断的好方法
- Linux----mktemp命令的用法
- HDU 1754 I Hate It(线段树单点替换/区间最值)
- intltool 的安装!!
- get()函数读顺序文件(C/C++源程序)
- 【设计模式】依赖倒置原则
- 多个授权文件共存的正确方法
- jsp网页在线编辑器
- CSS3
- nyoj 最长公共子序列 36 (简单LCS模板)
- XML::Parser perl module is required for intltool错误
- jQuery复制表单元素
- A different object with the same identifier value was already associated wit
- MYSQL主从同步故障一例及解决过程!
- Solr 3.5 + Tomcat7 + mmseg4j + 搜狗词库 -配置并运行
- Flume学习8_Flume1.5.0入门:安装、部署、及flume的案例