.TH ip4_scan 3
.SH NAME
ip4_scan \- parse an IPv4 number in dotted-decimal notation
.SH SYNTAX
.B #include <ip4.h>
int \fBip4_scan\fP(const char *\fIsrc\fR,char \fIip\fR[4]);
.SH DESCRIPTION
ip4_scan parses an IPv4 number in dotted-decimal ASCII representation
from \fIsrc\fR and writes the result into \fIip\fR. It returns the
number of bytes read from \fIsrc\fR or 0 if the parsing failed.
Unlike many other IP parsing routines, ip4_scan does not recognize octal
(like \fB0177.0.0.1\fR) or hexadecimal numbers (like \fB0x7f000001\fR).
.SH EXAMPLE
#include <str.h>
.br
#include <ip4.h>
char buf[]="160.45.40.10";
char ip[4];
if (ip4_scan(buf,ip) != str_len(buf))
parse_error();
.SH "SEE ALSO"
ip4_fmt(3), ip6_scan(3)
|