i want to read each line of my file in seprated string
what i have achieved till now is i can read the whole lines in one string
and now i want to read each line in a sprated string
any help;
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
ofstream myfile ("example.txt",ios::trunc);
if (myfile.is_open())
{
myfile<<"Hossam Hassan Hossney "<<endl;
myfile<<"20070123 "<<endl;
myfile<<"hossambob2003@hotmail.com ";
myfile.close();
}
else
cout<<"unable to open the file";
ifstream myReadFile;
string name;
string temp;
myReadFile.open("example.txt");
char output[100];
if (myReadFile.is_open()) {
while (!myReadFile.eof()) {
getline(myReadFile,name);
cout<<name;
}
}
system("PAUSE");
return EXIT_SUCCESS;
}