The output for newInfo[0] is blank. it should be the record number
Code:
string *changeData(string arr[][4],int records) { string newInfo[5]; stringstream ss; ss << recordSelected; newInfo[0] = ss.str(); cin.ignore(1); cout << "New ID: "; getline(cin,newInfo[1]); cout << "New DESC: "; getline(cin,newInfo[2]); cout << "New COST: "; getline(cin,newInfo[3]); cout << "New SUPPLY: "; getline(cin,newInfo[4]); string *arr2 = newInfo; system("pause"); return(arr2); } int main() { int c = countRecords(fileName,false);// c=2 string (*p)[4] = new string[c][4]; string newInfo[5] = {*changeData(p,c)}; cout << newInfo[0] << endl; // [B]Output is blank[/B] }
Comment