All pastes #798057 Raw Edit

Untitled

public c v1 · immutable
#798057 ·published 2007-11-26 15:35 UTC
rendered paste body
#include <stdio.h>#include <string.h>int ip_to_int(char gg[]) {    char ip[16], *r;    int i = 0, j;    long ips[4], v = 0;    strncpy(ip, gg, 16);    r = strtok(ip, ".");    while (r != NULL) {        j = atoi(r) << 8*(3-i);        v = v | j;        r = strtok(NULL, ".");        i++;    }    printf("v: %d\n", v);    return v;}int main(int argc, char* argv[]) {    printf("%d\n", ip_to_int("100.100.100.5"));    return 0;}