I am trying to read a hexadecimal input from stdin in c. The input is already in a hexadecimal format, for example, a input can look like this 616263. I want to read it from stdin and interpret it as unsigned long int msg = 0x616263;

I understand that stdin only reads ascii chars but is there a way to interpret it as hexadecimal values?