Fixed mixing of C style and C++ IO