hi i am reading a binary file using c as shown here link text
so that all the information read from binary file is stored in "char *buffer". i have the format standard where it says that one of the lines should be
format: unsigned char, size: 1 byte
i am doing the following:
printf("%x\n", buffer[N]);
but what should i do when the format says:
format: unsigned short, size: 2 bytes
if i do it as follows, would this be correct:
printf("%d%d\n", buffer[N], buffer[N+1]);
if not can you show me the correct way?
Also can you tell me if the following are correct way while printing:
char %c
unsigned long %ul
unsigned short %d
unsigned char %x
double %f
long %ld
all of the data in binary file is in little-endian format! thanks a lot in advance!