#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
void t(ifstream &in, string &s)
{
in.close();
in.clear();
in.open(s.c_str());
char buf[100];
while(in.getline(buf,100))
{
istringstream stream(buf);
string word;
while(stream>>word)
{
cout <<word<<",";
}
cout <<endl;
}
};
int main()
{
ifstream in;
string s ="tian.txt";
t(in,s);
cout << "Hello world!" << endl;
return 0;
}
#include <fstream>
#include <sstream>
using namespace std;
void t(ifstream &in, string &s)
{
in.close();
in.clear();
in.open(s.c_str());
char buf[100];
while(in.getline(buf,100))
{
istringstream stream(buf);
string word;
while(stream>>word)
{
cout <<word<<",";
}
cout <<endl;
}
};
int main()
{
ifstream in;
string s ="tian.txt";
t(in,s);
cout << "Hello world!" << endl;
return 0;
}