档案阅读有些线路后停止
File reading sort of stops after some lines
我必须读取一个始终具有n行的文件输入。每行由两个整数组成。具体来说,我正在读一个文件,其中两个整数均为2^(line_index -1)。
int temp1, temp2;
std::vector<int> vec1, vec2;
std::fstream fh("input.txt", std::ios_base::in);
for (int i = 0; i < N; i++) {
fh >> temp1 >> temp2;
vec1.push_back(temp1);
vec2.push_back(temp2);
}
//first few lines of input are
//1 1
//2 2
//4 4
// . . .
//Line 31 should be: 2147483647 2147483647
//but my code read it as 2147483647 1073741824
//This is always the case for N>30
在第30行之后,正如您在上面的摘要上看到的那样,文件读数变得很奇怪。我的代码中有问题吗?或我读取文件限制的方法我可以输入的变量?
您正在达到整数限制,例如,请参见此问题。不知道为什么要这样做,但是如果要节省更大的值,则需要其他数据类型。
相关文章:
- QProcess无法通过QPushButton执行终端线路命令
- Qt C++括号匹配和突出显示当前线路功能无法协同工作
- 线路抑制状态错误 C4703 可能未初始化的局部指针变量"back"已使用
- 使叮当声忽略对线路的评论
- 到达线路时程序崩溃
- 支持档案wxWidgets中文件名的Unicode
- 仍然没有新线路
- OpenGL闪烁,并提取比C 更多的线路
- 似乎无法通过线路读取TMP文件
- CPACK:档案中缺少接口
- 如何发布数据,包括使用libcurl(用于InfuxDB)的线路中断
- 档案阅读有些线路后停止
- 如何在每个XML节点上添加线路断裂
- 是否有一种方法可以找到导致警告出现在QT中的线路
- Winapi Lineto不会刷新线路
- 在文件中找到带有特定字符串的线路
- 线路词典有点像捕获量的文件
- 试图打印数组,但在打印之前正在输入一条新线路
- 如何使用C 在线路和列中写入文本文件
- OPENCV如何重新连接中间具有空白或曲率的线路