Question: In C language: Implement function int file_to_hex(const char *filename) whichreads from the file (file name is given as a parameter) and printsall contents of the
In C language:
Implement function int file_to_hex(const char *filename) whichreads from the file (file name is given as a parameter) and printsall contents of the file in hex format: each of the file byte isprinted in two-character hexadecimal format. If hex value is lessthan 0x10, then 0 must be appended to the front. Each line musthave only 16 hex values with space between hex values. Only 16 hexvalues must be printed in one line and there should be a spaceafter the last value. After printing 16 hex values, move on to thenext line.
Here is an example output:
0e 54 65 65 6d 75 20 54 65 65 6b 6b 61 72 69 30 30 30 30 30 41 00 00 14 45 4c 45 43 2d 41 31 31 30 30 00 00 00 00 00 00 00
Function file_to_hex must returnnumber of bytes read from the file or “-1” if an error occursduring reading from the file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
