samedi 25 avril 2015

Read up to delimeter from a file [duplicate]

I feel like an idiot for having to ask this since I've been programming with C++ for years, but I can't figure out the easiest/best way to read this data from a file. The file is structured like so:

firstName lastName, num1 string1 num2 num3

The first and last name need to be stored in a single string variable name as per program requirements. I know I can combine different string/file processing methods to do this but I feel like there's probably a way to do it in 1-3 lines of code that I'm completely forgetting. Everything I've tried is either invalid or really long. How do I read this in?

Aucun commentaire:

Enregistrer un commentaire