current file writing with fprintf