SCANF_L(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

🌸 NAME 🌸

Okay bestie, meet the _l scan squad: scanf_l, fscanf_l, sscanf_l, vfscanf_l, vscanf_l, and vsscanf_l β€” it’s giving input format conversion πŸ’…βœ¨. This is the SCANF_L(3) page, hanging out in the Library Functions Manual, and yes, it’s literally the locale-flavored scan family 🫢.


πŸ¦‹ LIBRARY πŸ¦‹

Library check: Standard C Library (libc, -lc) β€” that’s the whole vibe πŸ§šπŸ’–.


✨ SYNOPSIS ✨

Copy-paste era, but keep it exact bestie β€” every line and every restrict stays right where it is:

#include <stdio.h>
#include <xlocale.h>

int
scanf_l(locale_t loc, const char * restrict format, ...);

int
fscanf_l(FILE * restrict stream, locale_t loc,
    const char * restrict format, ...);

int
sscanf_l(const char * restrict str, locale_t loc,
    const char * restrict format, ...);

int
vfscanf_l(FILE * restrict stream, locale_t loc,
    const char * restrict format, va_list ap);

int
vscanf_l(locale_t loc, const char * restrict format, va_list ap);

int
vsscanf_l(const char * restrict str, locale_t loc,
    const char * restrict format, va_list ap);

πŸ’… DESCRIPTION πŸ’…

So the above functions scan input according to a specified format, but they do it in the locale loc πŸ‘‘. They behave the same way as the versions without the _l suffix, except they use the specific locale instead of the global or per-thread locale 🌈. For the full tea, see the specific manual pages β€” iykyk πŸ“.


πŸ”₯ SEE ALSO πŸ”₯

Go read those if you want the deeper lore πŸ’œ.


⭐ STANDARDS ⭐

Heads up: these functions do not conform to any specific standard, so they should be considered as non-portable local extensions πŸ’€. Slay locally, but don’t expect them to travel everywhere, fr fr.

πŸŽ€ HISTORY πŸŽ€

These functions first appeared in Darwin and were first implemented in FreeBSD 9.1 πŸ¦‹βœ¨. Little icon behavior.


Cute sign-off time: this page’s footer tea is Debian and the date April 8, 2012 πŸ’–πŸŽ€. That’s the source/version-and-date moment, wrapped up with a bow 🫢🌸.

πŸ“¦ where this page comes from