C++ how can you tweak this to read comma separated values
Posted: Tue Jul 12, 2022 8:09 am
C++ how can you tweak this to read comma separatedvalues
void read (vector list){ string str; ifstream file("data.txt"); while(file>>str) { char *co_str = new char[str.length() strcpy(co_str, str.c_str()); list.push_back(co_str); copy(list.begin(), list.end(), ostream_iterator(cout, "\n")); } + 1];
void read (vector list){ string str; ifstream file("data.txt"); while(file>>str) { char *co_str = new char[str.length() strcpy(co_str, str.c_str()); list.push_back(co_str); copy(list.begin(), list.end(), ostream_iterator(cout, "\n")); } + 1];