vector - How to split the the content of a file into many individual tokens? -
i have problem not being able split content of text file tokens. beginner @ visual c++, here code:
if (openfiledialog1->showdialog() == system::windows::forms::dialogresult::ok) { if ((mystream = openfiledialog1->openfile()) != nullptr) { // insert code read stream here. streamreader^ sr = file::opentext(openfiledialog1->filename); try { string^ s = ""; while (s = sr->readline()) { std::string converted_s = msclr::interop::marshal_as< std::string >(s); studentmc.push_back(converted_s); numberoftokens = numberoftokens + 1; } } { if (sr) delete (idisposable^)sr; } mystream->close(); } }
the problem facing whole content of text file chosen dialog box being pushed studentmc std::string vector 1 big line. need able split content many individual tokens.
sorry not professional coding, beginner , did not take university level classes in c++, trying make programs. me find way split content individual tokens ?
thank you.
Comments
Post a Comment