I am now using Dev-C++ 4, and am trying to upload my vector elements using the infile as I did with VC4, but I do realize that they are not the same.
It compiles right, but I get an error when running it saying it has performed an illegal operation and closes. Any help?Code:#include <fstream> #include <vector> #include <string> #include <stdlib.h> int main() { // dcelare variables ifstream infile; std::vector <string> username; username.reserve(100); short index; // get usernames from file infile.open("user_db.dat", ios::in); index = username.size(); do { index--; infile >> username[index]; } while(index != 0); infile.close(); system("PAUSE"); return 0; }
JDM




Reply With Quote