1 Content-type: text/html
3 <HTML><HEAD><TITLE>Manpage of IPSEC_ATOUL
</TITLE>
6 Section: C Library Functions (
3)
<BR>Updated:
11 June
2001<BR><A HREF=
"#index">Index
</A>
7 <A HREF=
"http://localhost/cgi-bin/man/man2html">Return to Main Contents
</A><HR>
10 <A NAME=
"lbAB"> </A>
13 ipsec atoul, ultoa - convert unsigned-long numbers to and from ASCII
14 <A NAME=
"lbAC"> </A>
17 <B>#include
<<A HREF=
"file:/usr/include/freeswan.h">freeswan.h
</A>></B>
20 <B>const char *atoul(const char *src, size_t srclen,
</B>
24 <B>int base, unsigned long *n);
</B>
28 <B>size_t ultoa(unsigned long n, int base, char *dst,
</B>
32 <B>size_t dstlen);
</B>
34 <A NAME=
"lbAD"> </A>
37 These functions are obsolete; see
38 <I><A HREF=
"ipsec_ttoul.3.html">ipsec_ttoul
</A></I>(
3)
40 for their replacements.
45 converts an ASCII number into a binary
51 does the reverse conversion, back to an ASCII version.
54 Numbers are specified in ASCII as
58 octal with a leading zero (e.g.
62 or hexadecimal with a leading
69 in either upper or lower case.
78 specifies the length of the ASCII string pointed to by
81 it is an error for there to be anything else
82 (e.g., a terminating NUL) within that length.
83 As a convenience for cases where an entire NUL-terminated string is
110 in which case the number supplied is assumed to be of that form
121 in which case the number is examined for a leading zero
125 to determine its base,
129 (halfway between
10 and
16),
130 which has the same effect as
133 except that a non-hexadecimal
134 number is considered decimal regardless of any leading zero.
143 specifies the size of the
147 under no circumstances are more than
153 A result which will not fit is truncated.
156 can be zero, in which case
159 need not be valid and no result is written,
160 but the return value is unaffected;
161 in all other cases, the (possibly truncated) result is NUL-terminated.
182 returns NULL for success and
183 a pointer to a string-literal error message for failure;
187 returns the size of buffer which would
189 accommodate the full conversion result, including terminating NUL;
190 it is the caller's responsibility to check this against the size of
191 the provided buffer to determine whether truncation has occurred.
192 <A NAME=
"lbAE"> </A>
195 <A HREF=
"atol.3.html">atol
</A>(
3),
<A HREF=
"strtoul.3.html">strtoul
</A>(
3)
196 <A NAME=
"lbAF"> </A>
207 non-digit character found;
208 number too large for an
209 <B>unsigned long
</B>.
211 <A NAME=
"lbAG"> </A>
214 Written for the FreeS/WAN project by Henry Spencer.
215 <A NAME=
"lbAH"> </A>
218 There is no provision for reporting an invalid
226 The restriction of error reports to literal strings
227 (so that callers don't need to worry about freeing them or copying them)
228 does limit the precision of error reporting.
231 The error-reporting convention lends itself to slightly obscure code,
232 because many readers will not think of NULL as signifying success.
233 A good way to make it clearer is to write something like:
238 <B>const char *error;
</B>
240 <B>error = atoul( /* ... */ );
</B>
241 <B>if (error != NULL) {
</B>
242 <B> /* something went wrong */
</B>
250 <A NAME=
"index"> </A><H2>Index
</H2>
252 <DT><A HREF=
"#lbAB">NAME
</A><DD>
253 <DT><A HREF=
"#lbAC">SYNOPSIS
</A><DD>
254 <DT><A HREF=
"#lbAD">DESCRIPTION
</A><DD>
255 <DT><A HREF=
"#lbAE">SEE ALSO
</A><DD>
256 <DT><A HREF=
"#lbAF">DIAGNOSTICS
</A><DD>
257 <DT><A HREF=
"#lbAG">HISTORY
</A><DD>
258 <DT><A HREF=
"#lbAH">BUGS
</A><DD>
261 This document was created by
262 <A HREF=
"http://localhost/cgi-bin/man/man2html">man2html
</A>,
263 using the manual pages.
<BR>
264 Time:
21:
40:
18 GMT, November
11,
2003