Hey guys,

I'm trying to learn c++, but i think i may need a little help at this point.
I want to read some data from a file "test.dat", but for some reason it won't work.
I don't see where i mess up, maybe you can help me.

thanks


Code:
#include <iostream>
#include <fstream>

using namespace std;

int main() {

// Open the file 
 ifstream infile("test.dat", ios::in | ios::nocreate);

// Check
 if (!infile.good()) {
  cout << "Error" << endl << endl;
  system("PAUSE");
  exit(1);
 }

 double value, type1, type2, type3, type4, type5;

// Read the data
   infile >> value >> type1 >> type2 >> type3 >> type4 >> type5;
   while (value!=-1) {
    infile >> value >> type1 >> type2 >> type3 >> type4 >> type5;
    cout << value << "\t" << type1 << "\t" << type2 << "\t" 
         << type3 << "\t" << type4 << "\t" << type5 << endl;
   }

 system("PAUSE");
 return(0);
}