在文本文件读取过程中的调试断言
Debug assertion during text file reading
我正在尝试从文本文件中读取4个浮动变量,然后将它们放入函数中。
void Array::readFile()
{
ifstream myfile1("numbers.txt");
if (!myfile1.is_open()) {
cout << "The file could not be opened";
}
else {
while (myfile1.good())
{
double a, b, c, d;
myfile1 >> a >> b >> c >> d;
//addMethod(a, b, c, d));
}
}
}
和textfile数据的示例:
-0.143562 0.187022 0.130935 0.001797
我遇到的问题是我的调试断言失败了!行之后的错误:
else {
错误:表达式:_block_type_is_valid(phead-> nblockuse)
现在,我什至无法在while循环内部测试代码,因为它在此之前就断开了。我是C 的新手,因此在此类错误中不经历。我的文本文件位于带有EXE文件的调试文件夹中。
这里有一些GIST:array.cpp:https://gist.github.com/anonynymous/f9a9942bced0096613bfarray.h:https://gist.github.com/anonymous/ce68c4fe94949413487697来源/主:https://gist.github.com/anonymous/7545C4598196501A69D8
Array
的驱动器做到这一点:
delete this->sphereArray;
但是,构造函数(或其他任何地方)都没有任何初始化的。
此外,Array::sphereArray
的定义是这样的:
sphere *sphereArray[sizeof(sphere)];
您不能delete
。也许您想浏览该数组的元素并删除它们。但是它们也是一个非传统的。另外,我非常怀疑线条并不能做您认为的事情。声明一系列指针是他们指向的类型的长度是非常不寻常的。
相关文章:
- 从 exe 文件 (Visual Studio ) 启动时调试断言失败
- 使用扫描的调试断言失败
- 图片不显示,关闭时出错 --> 调试断言失败!表达式:is_block_type_valid(标头>_block_use)
- C++ 调试断言失败 - 矢量下标超出视觉工作室的范围
- 调试断言失败的缓冲区!=nullptr
- 获取有关调试断言失败的错误:表达式:"(_Ptr_user &(_BIG_ALLOCATION_ALIGNMENT -1)) == 0" &&0
- 在Win10上使用带有Qt5的OpenCV3.0,调试断言失败
- C++,弹出调试断言失败窗口,我得到矢量迭代器不兼容的错误运行时
- C++ 调试断言失败,无效的空指针
- 如何在 Linux 上强制执行矢量下标超出范围的调试断言
- 调试断言仅在某些情况下失败?C++
- 调试断言失败
- 映射/集迭代器不可取消引用 (C++) - 调试断言失败
- std::vector<std::vector<int>>:调试断言失败。C++矢量下标超出范围保留内存
- 使用 Microsoft VS 编写程序C++,但我在这里收到调试断言消息.它可以在 cpp.sh 上运行,repl.i
- 字符串抛出矢量下标调试断言
- 使用调试断言时避免 ODR 冲突
- MFC DDX_RADIO会导致调用dodataexchange(dlgdata.cpp行286)时导致调试断言失败
- 无法在谷歌测试中捕获调试断言(死亡测试不满足它)
- 调试断言失败的矢量下标超出C 范围