Easiest way to scan string to parse out it's parts?
I input a line from a file, into a string called line. I then want to scan it to get all the individual parts of it, but I'm unsure of how to do that in c++.
Here's my code:
Code:
getline (myfile, line);
// sscanf(line, "%s %s %s %s", &nickName, &firstName, &secondName, &thirdName);
// the sscanf line is what I'm trying to do
It's in a specific format the file I'm scanning in, so it's always 3 or 4 words, separated by spaces (the middle name is sometimes included, sometimes not)