I have a program called main:
#include<iostream>
#include<fstream>
using namespace std;
#include"other.h"
int main()
{
//do stuff
}
and then other.h:
char* load_data(int begin_point,int num_characters)
{
seekg(begin_point);
char* return_val=new char[num_characters+1];
mapdata.getline(return_val,num_characters);
return...
Requirement :
I must read until EOF (16 bytes a
time) from a particular file , and
then say sleep for 5 seconds. Now,
after 5 seconds, when I try to read
from the file (whose contents would
have been appended by that time), the
intended design must be in such a way
that it reads from the point where it
left previou...
I am trying to make my file parsing more robust. Using an ifstream, how can I ensure seekg keeps me in a valid position within the file?
This does not work:
while(m_File.good() && m_File.peek() != EOF)
{ ...a seekg operation moves file position past end of file... }
I assume the current iterator has been pushed way past the end iter...
I have a 2884765579 bytes file. This is double checked with this function, that returns that number:
size_t GetSize() {
const size_t current_position = mFile.tellg();
mFile.seekg(0, std::ios::end);
const size_t ret = mFile.tellg();
mFile.seekg(current_position);
return ret;
}
I then do:
mFile.se...
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 istream. My XML data is coming from a Windows COM IStream. I thought I'd do the Right Thing and create an adapter to take the IStream data and p...