I am trying to open an .obj file which contains the vertices and faces of a sphere from Blender. The problem is i can't seem, for the life of me, open the file which contains the .obj data. I have tried using a normal C++ way to write to .txt file to check where would the appilcation create it, and maybe try to put the .obj file in that folder. The code i have used to write to the .txt file is as follows:
std::ofstream myfile("nestotamo.txt");
if (myfile.is_open())
{
myfile << "This is a line.\n";
myfile << "This is another line.\n";
myfile.close();
}
else DebugPrint("Unable to open file");
The code i posted doesn't work, the file doesnt even get created. From where should i try to load the .obj file, and why can't i even create a regular .txt file to find out the location where the app places them.
The code i used to try to load the data is as follows:
std::wifstream fileIn(path.c_str());
if (fileIn)
{
while (fileIn)
{
wchar_t line[64];
fileIn.getline(line, 64);
DebugPrint(line);
}
}
else {
DebugPrint("\t The file wasnt loaded...\n");
}
Any help would be much appreciated.
I have found out that i can't use regular c++ when working with files becuase DirectX has some additional constrictions on working with those. But, luckily i have found that the file needs to be in the following folder:
The code i used is: