thanks for the suggestions dude, but sadly it has not solved the problem. Here is the code (apologies for not posting it last time).
if(Scores.is_open())
{
MessageBox(NULL, TEXT("Scores was open."), TEXT("Info"), MB_OK);
Scores.close();
}
Scores.open("C:\\Documents and Settings\\Thomas\\Desktop\\My Documents\\Visual Studio 2008\\Projects\\Dark Invaders\\Dark Invaders\\scores2.csv", ios::in | ios::out);
if(Scores.is_open())
{
MessageBox(NULL, TEXT("Scores is now open."), TEXT("Info"), MB_OK);
for(int i=0; i<9; i++)
{
MessageBox(NULL, TEXT("Inside the loop"), TEXT("Info"), MB_OK);
Scores<<iTopScores[i];
Scores<<",";
}
Scores<<iTopScores[9];
Scores.close();
}
I put in the message boxes for debugging. The first box dosnt appear which is correct because there should be no file open. The 2nd does appear which is fine because i just opened the file and finaly the third appears (multiple times obv) which shows that its entering the loop.
I also added the full file path when opening the file, to make sure it wasnt trying to look somewhere else.
Is there something completely obvious that i am missing? The file already exists but i have tried deleting it and making the program the create a new one just before it goes to open it. I have tried all the combinations of ios::in, out, app, ate, trunc etc.
Just not understanding this one
"Knowledge is Power"