// Ess1.7.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
//ofstream outfile("seq_data.txt", ios_base::app);
ofstream outfile("seq_data.txt");
for( int i = 0; i < 10; i ++ ){
stringstream i_tos;
i_tos<<i;
string user_name = "wind" + i_tos.str();
string user_pwd = "wind";
if( !outfile){
cerr<<"oops, Unable to save session data!";
}else{
outfile << user_name << ' '
<< user_pwd << endl;
}
}
ifstream infile("seq_data.txt");
if( !infile ){
cerr<<"can't open file!";
}else{
string name = "", pass = "";
while( (infile >> name) && (infile >> pass) ){
cout<<name<<"------"<<pass<<endl;
}
}
return 0;
}