如何将istream的指针移动n个字符
How to move the pointer of istream by n characters?
我想跳过二进制文件中两个istream getline之间的几个字符。最好的方法是什么?
Shell我刚刚用istream::read?
或者shell我使用n=istream::tellg和istream::seekg=n+1000?
您可以简单地使用std::ios::cur
位置参数相对于当前位置移动流位置:
std::ifstream f("myfile.txt"); // current position 0
f.seekg(200, std::ios::cur); // relative seek
负值也是允许的。例如,请参见此处。
相关文章:
- 移动二维数组中的字符
- 碱基对映射 - 将 argv[i] 移动到整数或字符作为输入
- 如何找到通过仅移动相邻字符创建的字符串的排列?-C++
- 将原始指针移动到已创建函数中的下一个字符
- 我正在尝试在字符数组的中间添加一个空格.不确定如何正确移动它
- 位移动,未签名的字符
- 如何在不删除任何字符的情况下将字符从字符串中的某个位置移动到其最前面
- 移动字符数组的值以注册 x86 内联程序集
- 如何通过将特定的字符组合移动到空数组来"delete"单词和元音?
- 将 std::string 中的文本块向左移动 X 个字符
- 矩阵中字符的随机移动
- 如何在 c++ 中在屏幕上移动文本字符
- C++找到特殊的字符并移动到字符串的末尾
- 在 c# 中将 int 添加到字符以将其 ascii 值向上移动(就像在 c++ 中一样)
- 在字符指针中用内存移动替换字符
- 有没有一种方法可以将无符号字符块移动到 STL 向量中,而不是一次移动 1 个无符号字符
- C++字符数组正确移动null终止符
- UE4.9:移动字符(未设置位置)
- 如何在数组中移动字符
- 如何在c++中移动字符数组的某些位置