fstream not opening file

my file is sitting in the netbeans resources folder(which by the way is already annoying to add into, a right click and then add existing item option...) and I constantly(always) get the error message from this.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <iostream>
using namespace std;

void openFile(){
    fstream iFile("employee_data_in1.txt",fstream::in);
    
    if(!iFile){
        cout << "\n\tError: iFile not found at openFile()\n";
    }else
        cout << "\n\tiFile opened\n";
    
}


That's everything I included, and then the function itself, the only thing I didn't put was the function prototype, since it shouldn't effect this at all.
infact, I wanted it to do fstream::in | fstream::out
But tried settling for the previous hoping it would work.
You'll need to provide the full path to the file if it is not residing in the working directory for the executable. Also it's not fstream::in but ios_base::in.
Topic archived. No new replies allowed.