split a string at first whitespace

Hi can anyone help. I appreciate any help I can get. How do you split a string that you are reading from a file at the first whitespace? Do you use substring to do that?

Yes. Use find() to find the space and substr() to get the sections.
while you are reading from the file?

in that case you can use getline() with ' ' as a delimiter
if you use file >> string it should break when a whitespace is found
Topic archived. No new replies allowed.