As it stands, your question makes no sense. Do you mean "How can I write the hexadecimal representation of a binary file?".
If the answer is
yes, then you may find the following code useful:
#include <stdio.h>
int main(int argc, char * argv[])
{
int n, count;
FILE * fpi, *fpo;
if (argc != 3)
{
fprintf(stderr, "usage %s <binary_filename> <ascii_filenam>\n", argv[0]);
return -1;
}
fpi = fopen(argv[1], "rb");
if (!fpi)
{
printf("unable to open file %s\n", argv[1]);
return -2;
}
fpo = fopen(argv[2], "w");
if (!fpo)
{
printf("unable to open file %s\n", argv[2]);
fclose(fpi);
return -3;
}
count=0;
while ( (n=fgetc(fpi)) != EOF)
{
int i;
for (i=0; i<2; i++)
{
unsigned char b = (n & 0xF0) >> 4;
if ( b < 10 )
fputc(b + '0', fpo);
else
fputc(b-10 + 'A', fpo);
n <<= 4;
}
count++;
if (!(count % 16))
fputc('\n', fpo);
else
fputc(' ', fpo);
}
fclose(fpo);
fclose(fpi);
return 0;
}
:)