c++ - Loading Data From Comma Separated Text File to 2D Array? -
i trying load data text file looks this: 161,77,88,255 0,44,33,11,111 etc. have functions manipulate it, , ensured array correct size (which may still vary). below attempt @ implementation: bool loaddata(int **imgpix, string filename) { ifstream inputfile; inputfile.open(filename.c_str()); string templinerow; //the resulting line text file string tempelementcolumn; //the individual integer element int numberofcols = 0; int numberofrows = 0; if (!inputfile.is_open()) { return false; } imgpix = new int* [numberofrows]; while (getline(inputfile, templinerow, '\n')) { stringstream ss; ss << templinerow; //stringstream version of line while (getline(ss, tempelementcolumn, ',' )) { stringstream ss2; ss2 << tempelementcolumn; ss2 >> numberofcols; //prob? (**imgpix) = *(*(imgpix + numberofrows) + numberofcols); numberofcols++; } numb