If you want to print to your own file you don't need the DEFINE_RW_FILE function. You can just write your 3 lines fopen, fprintf, fclose anywhere you want (e.g. in your DEFINE_ADJUST function). But keep in mind opening and closing a file each time, takes "a lot of time" and therefore your runtime will be longer.