代码块不知道当前文件

CodeBlocks doesn't know the current file

本文关键字:文件 不知道 代码      更新时间:2023-10-16

我正在尝试制作一个c++程序,读取当前目录上存在的文件"。我的问题是,当我尝试从代码块编译器打开它不工作,因为当我试图从可执行文件直接打开它,它的工作,任何想法??下面是代码:

int Min = 0, Max = 0, TestCase = 0;
Min = 4900;
Max = 4995;
for(TestCase = Min; TestCase < Max; TestCase++)
{
    ss << TestCase;
    FileName = ".\temp6\SetOfDifferentials" + ss.str() + ".txt";
    ss.str("");
    ifstream inputFile(FileName.c_str());
    if(inputFile.is_open())
    {
        int i = 0;
        while(getline(inputFile, line))
        {
            istringstream ss2(line);
            ss2 >> stringList;
            MyTempList.push_back(stringList);
        }
        for(int i = 0; i < MyTempList.size(); i++)
        {
            if(MyTempList[i] == "")
                MyTempList.erase(MyTempList.begin() + i);
        }
        for(int i =0; i < MyTempList.size(); i++)
            MyList.push_back(MyTempList[i]);
    }
    else
        continue;
}

在顶部菜单中选择Project -> Properties -> Build targets。

在这里你可以为你的项目和不同的目标改变"执行工作目录"。如果你想把它放在你的项目根目录下,把它改成"."

相关文章: