Hi,
I have the following problem. I am reading a very large file into my program (around 15000000 lines). But my !eof() test does not seem to recognise the end of file, which results in my program crashing.
Below the essential bit of the code:
my cout test is reached every single time, even tho i should not be any bigger than 25000000.PHP Code://variables
ifstream inEdges ("homogEdges.dat");
vector<unsigned long long> Vertex;
if(inEdges.good())
{
inEdges>>invalue;
while(!inEdges.eof())
{
//cout<<invalue<<endl;
Vertex.push_back(invalue);
inEdges>>invalue;
i++;
if(i>30000000)
{
cout<<invalue<<endl;
cout<<"this should not happen as the file is smaller"<<endl;
}
}
inEdges.close();
}
The file i am reading in looks like this:
233245 2345325
2341 21345
32466 234567
etc. (for ~12000000 lines)
obviously eof() cannot handle the file size? Is there any other way of testing for the end of file, as I don't want to do a for loop manually entering the amount of lines in the file every single time.
Thanks



Adv Reply



Bookmarks