Currently I am appending the folder to the filename to open a file in a sub-directory, and was wondering if there is a cleaner way to do it that makes it work on Windows and Unix based systems.
filein.open("./folder/" + filename);
I am thinking to make it work on windows I can do something like this:
filein.open("./folder/" + filename);
if(!filein.is_open()){
filein.open(".\\folder\\" + filename);
if(!filein.is_open()){
cout << "Unable to open file" << endl;
}
}
I am interested in knowing if there is something like a library function that can handle this.