Hi all,
I have done a word search within a text file and managed to find it on a particular line,
but i dont know what to do so as to get the word/number directly after the searched word.
e.g content with the text file
sdakodjskfjsdkfjasook
sample1. : ihavemakeit
sdofjsdfjasfjsdkf
dflsdj
sample2
Any help will be greatly appreciated.
ifstream in("sample.txt");
if (in!=NULL)
MessageBox::Show ("file exist");
string line;
std::string match("sample1\. \:");
while (getline(in, line))
{
stringstream sstrm(line);
std::string::const_iterator iter =
std::search (
line.begin(),
line.end(),
match.begin(),
match.end()
);
if (iter != line.end() )
MessageBox::Show ("word found:");
//from here what should i do get the
//whole line, if possible i just wanted to get
//words/numbers after the "sample. :"
//e.g sample. : ihavemakeit
//for this case i just wanted to get this "ihavemakeit"
//i have tried using convert string to char but
// dont seem to work.