seekg Questions

4

Solved

I am trying to read from a file which is growing (something similar to what tail -F does), but there must be some problems with my code: string log, logFile("test.log"); size_t p = 0; while(true)...
Deferent asked 1/8, 2012 at 10:28

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 ...
Lactoprotein asked 4/4, 2013 at 21:28

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...
Nicolina asked 21/7, 2015 at 12:4

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();...
Expiable asked 3/5, 2013 at 17:12

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...
Suk asked 30/3, 2013 at 16:5

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...
Boley asked 27/3, 2013 at 22:1

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...
Terrazas asked 10/2, 2013 at 0:10

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...
Advocaat asked 29/6, 2012 at 15:37

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 ...
Nonbeliever asked 26/2, 2012 at 6:8

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...
Evieevil asked 15/8, 2010 at 16:8
1

© 2022 - 2024 — McMap. All rights reserved.