ustrtod(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

ustrtod πŸ’…βœ¨

okay bestie, we're in the Allegro manual and this is the page for ustrtod(3) β€” literally about turning strings into floating point numbers. no cap. 🫢

πŸ’– NAME πŸ’–

ustrtod β€” converts a string into a floating point number. Allegro game programming library.

🌈 SYNOPSIS 🌈

#include <allegro.h>

double ustrtod(const char *s, char **endp);

✨ DESCRIPTION ✨

okay so here's the tea: ustrtod grabs as many characters of s that look like a floating point number and turns them into one. Then, if endp is not a NULL pointer, it sets *endp to point at the first unused character. it's giving "parse what you can, leave the rest." πŸ’…

Example:

char *endp, *string = "456.203 askdfg";
double number = ustrtod(string, &endp);

πŸ”₯ RETURN VALUE πŸ”₯

It returns the string converted as a value of type double. If nothing was converted, it returns zero, and *endp points to the beginning of s. no conversion? zero and back to the start, bestie. 😭

πŸ¦‹ SEE ALSO πŸ¦‹


That's the whole vibe. This page is from Allegro, version 4.4.3 β€” and the footer didn't give me a date, so I'm not making one up. periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from