Changed to std::ofstream::trunct instead.