代码块不知道当前文件
CodeBlocks doesn't know the current file
我正在尝试制作一个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。
在这里你可以为你的项目和不同的目标改变"执行工作目录"。如果你想把它放在你的项目根目录下,把它改成"."
相关文章:
- 我正在使用嵌套的while循环来解析具有多行的文本文件,但由于某种原因,它只通过第一行,我不知道为什么
- 如何在不知道大小的情况下读取文本文件并存储到数组中
- Nlohmann 在不知道密钥的情况下解析 JSON 文件
- 如何用 c++ 读取 txt 文件,如果我们不知道其中有多少个数据字符串,以及每行有多长?
- 如何从C 中的HDF5文件中读取属性名称和数据集名称,在这里我不知道HDF5文件中存在什么属性
- 如何在C 中编写一个程序,以说明不知道它正在阅读的数据文本文件中包含多少行
- 我可以在不知道文本文件的列数的情况下读取二维数组中的文件吗?
- 在C中如何在命令行中定义所有不知道宏(在源文件/标头文件中使用)
- 我不知道如何为从文件中读入的矩阵获取常量值
- 编译器不知道我的包含文件
- 打开文件时不知道名称
- 尝试对结构向量进行排序时,我在算法文件中收到 20 个错误。我不知道怎么了?
- 我是C++的新手,我不知道如何从.txt文件中输入多行数字
- ShellExecute 打开一个特殊文件夹(例如:"LibrariesDocuments" ),而不知道特殊文件夹名称
- 在头文件中声明一个动态分配的二维数组而不知道它的维数
- 代码块不知道当前文件
- C++ fwrite 不写入文本文件,不知道为什么?
- 我无法打开这个.a文件,也不知道如何使用它
- 当你创建c++文件时,XCode 4.1似乎不再创建头文件,不知道如何制作模板
- 在不知道初始文件大小的情况下用c++创建压缩文件