So I have a text file like this:
_________________________
Joe
Jim
Hello Jim,
Just wanted to say hello!
-Jim
EOF
Tom
Tim
Hello Tim,
Just wanted to say hello!
-Tim
EOF
__________________________
So the text file stores messages from a system. The first line is the sender, second line is recipient, third line is subject, and 4th line until "EOF" string is the message body.
So I was able to use getline to store the names and subject into variables, but I'm not sure what to use to store the message body as a single string variable.
So obviously, I need a condition that states to read until it gets to "EOF", then store everything before that into a string. Not sure how to do this in C++ though :(
It's due by the end of the night. Sorry I didn't mean to sound rude, just can't figure out how getline can put more than one line in a variable. I'm not asking for my work to be done, this is a small part of a big assignment. I'm asking for an example of actually how to use it.
I tried this:
while (messageBody != "EOF")
{
getline(fin, messageBody);
}
But yeah, all that does is keep changing the messageBody variable until it's EOF, I figured maybe something I could do to append it to the end of the string, but I dunno. I thought this was something simple :(