#include <stdio.h>
int main(void)
{
unsigned char a,b,c,d;
scanf("%hhu.%hhu.%hhu.%hhu", &a,&b,&c,&d);
printf("%hhu\t%hhu\t%hhu\t%hhu\t", a, b, c, d);
return 0;
}
gives
$ gcc t.c && ./a.out <<< 12.12.12.12
12 12 12 12
See for instance this reference to find which specifier to use depending on the type of the target variables (3rd table in the document).