cdrtools/libschily/astoi.3
2025-06-15 04:19:58 +08:00

56 lines
1.7 KiB
Groff

. \" Manual Seite fuer astoi
. \" @(#)astoi.3 1.3 15/04/26 Copyright 2015 J. Schilling
. \"
.if t .ds a \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'a
.if t .ds o \v'-0.55m'\h'0.00n'\z.\h'0.45n'\z.\v'0.55m'\h'-0.45n'o
.if t .ds u \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'u
.if t .ds A \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'A
.if t .ds O \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'O
.if t .ds U \v'-0.77m'\h'0.30n'\z.\h'0.45n'\z.\v'0.77m'\h'-.75n'U
.if t .ds s \(*b
.if t .ds S SS
.if n .ds a ae
.if n .ds o oe
.if n .ds u ue
.if n .ds s sz
.TH ASTOI 3 "15. Juli 1988" "J\*org Schilling" "Schily\'s LIBRARY FUNCTIONS"
.SH NAME
astoi() \- converts ASCII to integer
.SH SYNOPSIS
.nf
#include <schily/schily.h>
.sp
.B char *astoi(string,result)
.B
char *string; /* the string to convert */
.B
int *result; /* where to store the result */
.fi
.SH DESCRIPTION
astoi() converts the characters pointed to by string to an integer
stored at
.IR result .
It returns a pointer to the first character in the
string that was not used for the conversion. If the entire
string is to be used, it should point to a NULL character
('\\0').
Leading spaces and tabs are skipped.
.LP
The ASCII string accepts a leading `+' or `\-'. A leading zero in
the string makes the number octal, while a leading 0x makes the
number hexadecimal.
Leading spaces and tabs are skipped.
.SH RETURNS
Returns a pointer to the first unused character.
.SH EXAMPLES
.nf
if (*astoi(string, &i) != '\\0')
error("Not a number %s\\n", string);
.fi
.SH "SEE ALSO"
.BR astol (3)
.SH NOTES
Range errors are not checked. Conversion stops (and a pointer
is returned) at the first non-numeric character other than the
leading sign or 0x, as described above.