I am writing a program that reads a file, whose first two lines are:
Field of space: 0.4
226981 20
Then I want to pass 226981 and 20 to integer variables. So I do:
ifstream vfile(file_name, ios::in);
vfile.getline(header,FILENAME); // Read the header-line
vfile >> nTot >> file_size;
If I compile the program with g++; I get for nTot
and file_size
the right values, 226981
and 20
, but If do it for Mac OS X Snow Leopard with the last Xcode
, I get 0
and 1634000000
respectively.
Has anyone experienced this kind of error?