ASTOI(3)
π astoi(3) β ASCII to integer, bestie π
okay so this is ASTOI(3), straight out of SchilyΒ΄s LIBRARY FUNCTIONS β and it's giving βturn text digits into a real integerβ energy. β¨
π NAME π
astoi()β converts ASCII to integer. periodt.
β¨ SYNOPSIS β¨
#include <schily/schily.h>
char *astoi(string,result)
char *string; /* the string to convert */
int *result; /* where to store the result */
π¦ DESCRIPTION π¦
astoi() converts the characters pointed to by string into an integer stored at 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. π«Ά
The ASCII string accepts a leading '+' or '-'. A leading zero in the string makes the number octal, and a leading 0x makes the number hexadecimal. And yeah β leading spaces and tabs are skipped. Again. Skipped. π
π₯ RETURNS π₯
Returns a pointer to the first unused character. That's the whole vibe check. π
πΈ EXAMPLES πΈ
if (*astoi(string, &i) != '\0')
error("Not a number %s\n", string);
π SEE ALSO π
π NOTES π
Range errors are not checked. Not even a little. π Conversion stops β and a pointer is returned β at the first non-numeric character other than the leading sign or 0x, as described above.
mwah π β Joerg Schilling, 2022/09/09, source/version: SchilyΒ΄s LIBRARY FUNCTIONS, page ASTOI(3). bye bestie π
π¦ where this page comes from
- opensuse-leap 16.0: libschily-devel-doc 2022.10.16-160000.2.2 Β· CDDL-1.0
- Copyright 2015 J. Schilling
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms