You know, there is not an 'hexadecimal format' for a file. However, there could be a file containing the hexadecimal representation of binary (as well ASCII) data.
To obtain such a file replace (as already suggested by
Richard)
Quote:
printf("%c", ch);
with
printf("%02X ", ch);