Your file write is also messed up.. have to hit the road, but I'll try to explain more later..

You should just open both input and output file pointers together.. read from 1, write to 2, then close both when done.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D