Hello,
I'm tring to read a text file and pull pieces of the line into separate functions.
I can open and close the file in the main. When I use the getline() it reads the whole line, I only want to read up to a certain point using strings instead of c-strings. Here is some of my code.:'(
void GetQuestion(ifstream &instream )
{ while (!instream.eof())
{ string line;
string sub_question;
getline(instream,line );
int FindFirstColon=0;
FindFirstColon=line.find(":"); //finds first Colon
if(FindFirstColon > -1)
{sub_question = line.substr(0, FindFirstColon); }
cout<<sub_question<<":"<<endl;
}
}