1scan_ip4(3)                Library Functions Manual                scan_ip4(3)
2
3
4

NAME

6       scan_ip4 - parse an IPv4 number in dotted-decimal notation
7

SYNTAX

9       #include <ip4.h>
10
11       int scan_ip4(const char *src,char ip[4]);
12

DESCRIPTION

14       scan_ip4  parses  an IPv4 number in dotted-decimal ASCII representation
15       from src and writes the result into ip. It returns the number of  bytes
16       read from src or 0 if the parsing failed.
17
18       Unlike  many  other  IP  parsing  routines, scan_ip4 does not recognize
19       octal (like 0177.0.0.1) or hexadecimal numbers (like 0x7f000001).
20

EXAMPLE

22       #include <str.h>
23       #include <ip4.h>
24
25         char buf[]="160.45.40.10";
26         char ip[4];
27         if (scan_ip4(buf,ip) != str_len(buf))
28           parse_error();
29
30

SEE ALSO

32       fmt_ip4(3), scan_ip6(3), inet_pton(3)
33
34
35
36                                                                   scan_ip4(3)
Impressum