Parsing by char

I am trying to read a title in from a file... how would i parse by char to create the title or is there a way to make it read up to the delimiter??

ex.

The Red Field#319831

How would i go about getting The Red Field into a string??

thanks...
Check out getline.
I would try something like:
1
2
3
ifstream infile("filename");
string mystring;
getline(infile, mystring, '#');


~psault
Or you may tokenize the string, i.e. divide it into bits that are seperated by characters you select.

See http://oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html section 7.3 on the issue.
Topic archived. No new replies allowed.