split a string at first whitespace

Dec 15, 2008 at 1:03am
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?

Dec 15, 2008 at 1:30am
Yes. Use find() to find the space and substr() to get the sections.
Dec 15, 2008 at 5:16am
while you are reading from the file?

in that case you can use getline() with ' ' as a delimiter
Dec 15, 2008 at 12:49pm
if you use file >> string it should break when a whitespace is found
Topic archived. No new replies allowed.