Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
char* to string conversion
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Daniel T., post: 2543498"] Do the lines have to maintain their order? Maybe this will help: ifstream afile( "document_name" ); string str; while ( getline( afile, str ) ) { try { // lexical_cast can be found in the boost library string::size_type comma = str.find( ',' ); int doc_num = lexical_cast<int>( str.substr( 0, comma ) ); char rev = str.substr( comma + 1 ).at( 0 ); // at this point the line has been parsed. // do what you want to it. } catch (...) { cerr << "bad data found in document"; } } [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
char* to string conversion
Top