Why does this crash with access violation to 0xcccccc...?

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-04-08T18:44:34Z Indexed on 2010/04/08 18:53 UTC
Read the original article Hit count: 387

Filed under:
|

I have a random piece of code, I use for reading from CSV files... and it's fine... until after about 2000 reads... then the getline line fails with an access violation to 0xcccccc... which I assume means that the input stream (file) has been cleared... Not that I know why :)

int CCSVManager::ReadCSVLine ( fstream * fsInputFile, vector <string> * recordData )
{
 string s;

 getline ( *fsInputFile, s );
 stringstream iss( s );

 for ( unsigned int i = 0; i < getNumFields (); i++ )
 {
  getline ( iss, s, ',' );
  (*recordData)[i] = s;
 }

 return 0;
    }

Any ideas why?

© Stack Overflow or respective owner

Related posts about c++

Related posts about iostream