changed Mode::Write to use fprintf instead of ofstream