minix/man/man3/strtol.3

34 lines
1.4 KiB
Groff
Raw Normal View History

.TH STRTOL 3 "December 9, 2009"
.UC 4
.SH NAME
strtol, strtoll, strtoul, strtoull \- convert string to number
.SH SYNOPSIS
.nf
.ft B
#include <stdlib.h>
long strtol(const char *\fInptr\fP, char **\fIendptr\fP, int \fIbase\fP);
unsigned long strtoul(const char *\fInptr\fP, char **\fIendptr\fP, int \fIbase\fP);
#ifdef __LONG_LONG_SUPPORTED
long long strtoll(const char *\fInptr\fP, char **\fIendptr\fP, int \fIbase\fP);
unsigned long long strtoull(const char *\fInptr\fP, char **\fIendptr\fP, int \fIbase\fP);
#endif
.fi
.SH DESCRIPTION
These functions parse as much from the string \fInptr\fP as possible and return
it as an integer. The string should consist of any number of whitespace
characters followed by a sign (either plus or minus) and at least one digit in
the specified \fIbase\fP. The digits of a hexadecimal string may be preceded by
the prefix 0x or 0X, which is ignored. If \fIbase\fP is zero, hexadecimal is
assumed if this prefix is present, octal is assumed if there is a leading zero
2009-12-16 13:17:02 +01:00
and decimal is assumed otherwise. If not zero, \fIbase\fP must be at least 2
and at most 36. A pointer to the first character following the numeric string is
stored in *\fIendptr\fP.
.PP
Note that the strtoll and strtoull functions, which return 64-bit values,
are supported only on GCC as ACK does not support 64-bit arithmatic.
.SH "RETURN VALUE
The parsed number is returned.
.SH "SEE ALSO"
.BR atoi (3).