feat(stdio): scanf family

This commit is contained in:
2026-09-05 21:52:22 -04:00
parent ddcf8f39be
commit 3eff4c97fd
3 changed files with 2540 additions and 0 deletions
+31
View File
@@ -429,4 +429,35 @@ fmemopen(void *buf, size_t size, const char *mode);
FILE *
open_memstream(char **ptr, size_t *sizeloc);
/* formatted input (todo 17) */
/*
* Read formatted input. scanf reads from stdin, fscanf from the stream,
* sscanf from the string. The conversion directives are %d %i %u %o %x %X
* %f %F %e %E %g %G %a %A %c %s %[ %p %n and %% (with assignment
* suppression '*', a decimal field width, and the length modifiers hh h l
* ll j z t, plus L for the float conversions). A conversion fails to match
* without consuming its offending character; the return value is the
* number of assigned (non-suppressed) input items, or EOF if an input
* failure occurs before the first one. Integer overflow stores a saturated
* value and sets errno = ERANGE (nothing else touches errno).
*/
int
scanf(const char *restrict format, ...);
int
fscanf(FILE *restrict stream, const char *restrict format, ...);
int
sscanf(const char *restrict s, const char *restrict format, ...);
int
vscanf(const char *restrict format, va_list ap);
int
vfscanf(FILE *restrict stream, const char *restrict format, va_list ap);
int
vsscanf(const char *restrict s, const char *restrict format, va_list ap);
#endif /* VLIBC_STDIO_H */