It was my fault. I didn't think of whitespace in the file.
There was no problem with whitespace handling on Windows.
Before the function, the file pointer was a garbage value.
dir = "data/foo/data 1.tui";
dir = "data/foo/data1.tui";
if (fp)
{
cout << fp << endl;
readCTE(*fp);
}