Hey again, I have yet again, another problem with my Database.....
I'm nearly finished my star wars database . Right now i'm trying to write a function that will search for a file according to user input, but the function will not open the file for some reason, I can't figure out how. Here is the code snippets of relevance:
DatabaseFileMgr.cpp:
There are the two main functions that I'm using. Can anyone help?Code:.... bool DatabaseFileMgr::bReadFromFile() { DatabaseResourceMgr TempResourceManager; char ch; /*Character for reading contents of file*/ std::ifstream iFile(m_cFilename); /*Create an ifstream object for opening a file for output*/ if(!iFile.is_open()) /*Checks if the file can be opened*/ { std::cout << "Error! Unable to open " << m_cFilename << "..." << std::endl << std::endl; /*If it can't, output this*/ TempResourceManager.vDisplayExitMessage(); return false; } else /*Otherwise...*/ { while(iFile.get(ch)) /*Read the characters from the file*/ { std::cout << ch; /*Output the file contents to the console*/ } std::cout << std::endl; /*Output a new line to the console after file contents is read*/ return true; } iFile.close(); /*Close the file after it's purpose has bin fullfilled*/ } void DatabaseFileMgr::vSearchForFile() { std::string sUserInput; std::cin >> sUserInput; if(sUserInput == "StarDestroyer") { vSetFileName("Imperial-I Star Destroyer"); bReadFromFile(); vClearFileNameBuffer(); } } ...