I want to write a program that would read a whole file and then write another file with its hex values (like a hex editor). I am a little bit confused with everything.
I have to open the file first. So first question: what is the difference between opening the file in text mode and opening the file in binary mode?. Then, use fread to read chunks of data and store them to an array. Here goes the second question. What should the array type be?
After that I guess I just do a loop like
or something.Code:for(x=0, x<size, x++) fprintf(file, "0x%X ", array[x])
Am I in the right tracks?