can't see vector problem [too many trees]
Posted on 2003-03-27
i have a text file search where i store the results in a vector which is
initialised in main 'vector<char *> results;'
//print the string
memset (printOut,' ',5);
cout << printOut << endl;
//add string to results vector
vector<char *>::iterator iter = results.end();
after the search is complete i try to save the results to a file from a different function.
i pass the vector by reference: 'void saveResults(vector<char *> &results)'
outfile << "search results:" << "\n";
vector<char *>::iterator iter = results.begin();
for (iter = results.begin(); iter < results.end(); iter++)
outfile << *iter << "\n"; //output each element of the vector
the output is blank both onscreen and in the file apart from the carriage returns.
i have checked the contents of the vector immediately after assigning the strings and it returns the strings no problem.