0

I'm trying to use Pocket CPP to compile C++ on notepad++. I cant get it to open the text file when using ifstream though. What folder to I put the txt file so that PocketCPP/NppExec reads it.

Man Man
  • 11
  • 1

1 Answers1

0

You can get the current working directory (where the txt should be located) compiling/executing the following example:

#include <iostream>
#include <vector>
#include <cstdlib>
#include <direct.h>

using namespace std;

int main() {
    vector<char> path(512);
    _getcwd(&path[0], path.size());
    cout << &path[0] << endl;
}

PS: I'm the creator of Pocket C++, you can use the issue tracker too. I'll add an issue to change the working directory in future versions (which I think it's should be the same of the .cpp file by default).

dacap
  • 478
  • 3
  • 19