Tips for Project 1… (Thanks to Ed Frey!)
unsigned short inBuffer;
unsigned char
buffer[100];
3.
use fscanf
instead of scanf since you will be reading from a file
4. use either the format string “%2hx” or
“%02x” Both of these is valid on many
systems, but the “%02x” string may not
work in your particular implementation.
If you have trouble, use “%2hx”.
fscanf(fin,"%2hx", &inBuffer);
printf("'%02hx'\n",inBuffer);
buffer[i] = (char)inBuffer;