put()函数把数据顺序写入文件

来源:互联网 发布:评论盖楼的数据库设计 编辑:程序博客网 时间:2024/05/16 11:10

#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/

 

0 0