Help with code(Binary to Hex)

This is a discussion on Help with code(Binary to Hex) within the C Programming forums, part of the General Programming Boards category; I need to write a program that reads a binary file and writes the file to a text file in ...

Help with code(Binary to Hex)

I need to write a program that reads a binary file and writes the file to a text file in ASCII Hex format.

I also need each line to be 16 bytes long or 32 characters like this:
:100000002345a42d etc.

":" is start of new line
"10" is number of bytes converted (in this case 16)
"0000" is 16 bit address of the first byte (next line will be 0010)
"00" is page number (always 00 for this assignment)

NEXT 32 characters represent 16 binary bytes

AT the end there must be a check sum byte ( the 2's complement of all the bytes in the line without colon.

This is the program that I have written. I have problem inserting all the numbers before my 32 characters and also the check sum. Also the last line could have less than 16 bytes so I need to include that too. All the work has to be done in processFiles function.