If the file is not too large this may be easier to read the entire file into a buffer then write out the file backwards using this buffer.

Remember that when you read a character the file pointer...