ASTOL(3)

πŸ“¦
version 2022.10.16 Β· 2 versions
, in opensuse-leap 16.0

✨ ASTOL(3) ✨

okay so bestie, welcome to ASTOL(3) β€” one of the little gems from SchilyΒ΄s LIBRARY FUNCTIONS. she's a converter girlie, and honestly? she ate. let's get into it πŸ’…


πŸ’– NAME πŸ’–

astol() β€” converts ASCII to long πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

astol(string,l)
char *string;
int *l;

🌸 DESCRIPTION 🌸

so astol() takes the characters that string points at and converts them into a long, which gets stored at l. no cap, that's the whole job ✨

then it returns a pointer to the first character in the string that was not used for the conversion β€” like, she used what she needed and left the rest for you, generous queen 🫢

if the entire string is meant to be used, it should point to a NULL character ('\0'). that's the vibe check: end it properly or she'll stop early and you'll be confused 😭

also, leading spaces and tabs are skipped. she's not gonna fight you over whitespace, she's chill like that πŸ’œ

🧚 EXAMPLES 🧚

extern char *astol();
if (*astod(string, &l) != '\0')
     error("Not a number %s\n", string);

literally the cutest little number-checker: if whatever comes back isn't '\0', you did not pass a number and error() gets to yell about it πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

her sisters!! go say hi, they're all iconic in their own way πŸ‘‘

⭐ RETURNS ⭐

Returns a pointer to first unused character. periodt πŸ’«


brought to you by Joerg Schilling, dated 2022/09/09, from SchilyΒ΄s LIBRARY FUNCTIONS β€” mwah, stan a legend πŸŒˆπŸ’–πŸŽ€

πŸ“¦ where this page comes from