Reading a txt file: incompatible length error

Hi,

Attached is my txt file (wetransfer link).

I want to read the lines from the txt into a variable:

string filePath = "../data/";
string fileName = "Heat_frame_0.txt";

// Read file.
{
    ifstream file(filePath + fileName);
    real[int] Ttt(2838);
    file >> Ttt;
}

Yet this results in an error saying:

 length on the array 2838 != 0 length in file
  current line = 12
Exec error : Fatal Error: incompatible length in read array (Op_ReadKN)

But both array and file length are the same. I don’t get it.

I found out that using the getline works way better.

      // Read file.
      {
          ifstream file(filePath + fileName);
          string line;
          // Read by line.
          for (int k = 0; k < Th.nv; k++){
            getline(file, line);
            temperatureField(k) = atof(line);
          }
      }