//Converts 4 char phrases into hex codes #include #include #include #define MAX_PROMPT 5 int main(void){ long code; char tmp[MAX_PROMPT+1]; while(1){ printf("Enter %d chars:", MAX_PROMPT-1); fgets(tmp, MAX_PROMPT, stdin); __fpurge(stdin); code = tmp[0]; code <<= 8; code |= tmp[1]; code <<= 8; code |= tmp[2]; code <<= 8; code |= tmp[3]; printf(">>%x\n", code); } }