【问题标题】:Pocket CPP/NppExec : Where does it search for txt files when using ifstreamPocket CPP/NppExec:使用 ifstream 时它在哪里搜索 txt 文件
【发布时间】:2013-09-19 04:36:15
【问题描述】:

我正在尝试使用 Pocket CPP 在 notepad++ 上编译 C++。不过,我在使用 ifstream 时无法打开文本文件。我将 txt 文件放在哪个文件夹,以便 PocketCPP/NppExec 读取它。

【问题讨论】:

    标签: notepad++ nppexec


    【解决方案1】:

    编译/执行以下示例可以获取当前工作目录(txt应该位于的位置):

    #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:我是Pocket C++的创造者,你也可以使用issue tracker。我将添加一个问题来更改未来版本中的工作目录(我认为它应该与默认的 .cpp 文件相同)。

    【讨论】:

      猜你喜欢
      • 2010-11-29
      • 2014-08-27
      • 2014-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多