typedef union ip {
int addr;
char bytes[4];
} addr_t;

addr_t foo;
sscanf("192.168.0.1", "%d.%d.%d.%d", &foo.bytes[0], &foo.bytes[1], &foo.bytes[2], &foo.bytes[3]);
printf("%x\n", foo.addr);
/* 不毛だ・・ */