seekg Questions
4
Solved
3
I am trying to write a program with a menu that reads from a text file a few different ways. I'm just working on menu option #2 still (reading backwards from the end of the file), but I can't wrap ...
2
Solved
I'm looking for a way to set my get pointer at position x from the end of an fstream.
I tried
file.seekg(-x, ios_base::end);
But according to this question, this line is undefined behavior.
H...
1
Solved
I need to read all blocks of one large file(about 10GB) sequentially, the file contains many floats with a few strings, like this(each item splited by '\n'):
6.292611
-1.078219E-266
-2.305673E+065...
Palecek asked 23/1, 2015 at 7:48
1
Solved
In c++, how expensive is it to use the istream::seekg operation?
EDIT: How much can I get away with seeking around a file and reading bytes? What about frequency versus magnitude of offset?
I hav...
Susuable asked 18/1, 2014 at 5:9
2
I am trying to do a seek and re-read the data. but the code fails.
The code is
std::ifstream ifs (filename.c_str(), std::ifstream::in | std::ifstream::binary);
std::streampos pos = ifs.tellg();...
1
Solved
Seekg does not seem to work, when I reach EOF in myFile.
ifstream myFile("/path/file");
for(int i; i < 10; i++){
myFile.seekg(0);//reset position in myFile
while(getline(myFile, line)){
doS...
1
Solved
I'm looking for some clarification on how seekg() and seekp() works with respect to when you are writing to a file. Say for instance I had a file like so:
offset 0: 2
offset 4: 4
offset 8: 6
offse...
1
Solved
In a scenario using seekg & tellg on a file, I was wondering what is happening under the hood?
// Open file and get file size
int myFileSize;
std::fstream myFile;
myFile.open(myFileName, s...
3
Solved
I found that in VS2010, seekg function does not work properly when file of exactly 4294967295 bytes is opened.
I'm using simple code:
#include <iostream>
#include <fstream>
using name...
Univalve asked 12/12, 2012 at 10:35
2
Solved
I am trying to write some simple code which will read a text file but reads the first line twice. I thought this would be as simple as something like this
std::ifstream file;
file.open("filename...
1
Is there a way I can check if an istream of ostream is seekable?
I suspect doing a test seek and checking for failbit is not correct
since the seek can fail for unrelated reasons.
I need this to ...
1
I used to be a C++ expert a decade ago, but for the past 10 years I've been programming Java. I just started a C++ project that uses a small third-party XML parser. The XML parser accepts an STL is...
1
© 2022 - 2024 — McMap. All rights reserved.