Skip to content

API ip2long

JoungKyun Kim edited this page Jul 13, 2016 · 3 revisions

NAME

ip2long - convert IPv4 ip address to 32bit positive integer

SYNOPSIS

#include <ipcalc.h>

unsigned long ip2long (char * ipaddress)

DESCRIPTION

ip2long API converts a string containing an (IPv4) Internet Protocol dotted address into a proper address

RETURN VALUE

if success, returns 32bit positive integer, and returns 0 on fails.

EXAMPLE

#include <ipcalc.h>

int main (void) {
    char * addr = "192.168.0.1";
    ulong r;

    r = ip2long (addr);
    printf ("LONG IP: %lu\n", r);

    return 0;
}

AUTHORS

JoungKyun.Kim <http://oops.org>

BUGS

Report to https://github.com/Joungkyun/libipcalc/issues

COPYRIGHT

Copyright (c) 2016 JoungKyun.Kim <http://oops.org>

This api is follows LGPL 2.1

SEE ALSO

long2ip(3)

Clone this wiki locally