What compiler are you using? Do you clean up all compiler warnings?After fixing the line that M.Hirsch mentioned, VC++ 6.0 says that the first argument, fPtr2, is being used without being initialized. And that is correct. There is a couple ways to fix that: (1) remove the parameter and make it local to the function writefile(), then writefile() should close the ...