Take Hexadecimal value in a variable in c from binary file

Friday, July 4, 2014

printf("Enter the name of file you wish to see\n");
fp = fopen(file_name,"rb");
while( ( ch = fgetc(fp) ) != EOF && loop)
printf("value of ch is %x\n",ch);

I have a binary file and I read it with "rb" permission.and printing its value in hexadecimal but if I am taking this value in a array for other purpose then it shows different value when I printing the array value which is not same as I printing in this above code.

please help me how can I store the data (Hexadecimal) of binary file in the array.