stdio.h(3)
πΈ stdio.h(3) β the avr-libc glow-up πΈ
okay bestie, sit down, hydrate, because this is the header. this is stdio.h from avr-libc β yes, the AVR C library, the one that lives rent-free in your microcontroller. it's giving "tiny chip, big dreams" energy and honestly? iconic. π
this page is a straight-up index, no cap β it's the header file listing every macro, typedef and function that stdio.h brings to the party. the real gossip (what each one actually does) lives in the individual man pages. this one's the guest list. π
β¨ SYNOPSIS β¨
π§ Macros
the preprocessor girlies. all of these get swapped in before your code even knows what hit it:
#define stdin (__iob[0])
#define stdout (__iob[1])
#define stderr (__iob[2])
#define EOF (-1)
#define fdev_set_udata(stream, u) do { (stream)->udata = u; }
while(0)
#define fdev_get_udata(stream) ((stream)->udata)
#define fdev_setup_stream(stream, put, get, rwflag)
#define _FDEV_SETUP_READ __SRD
#define _FDEV_SETUP_WRITE __SWR
#define _FDEV_SETUP_RW (__SRD|__SWR)
#define _FDEV_ERR (-1)
#define _FDEV_EOF (-2)
#define FDEV_SETUP_STREAM(put, get, rwflag)
#define fdev_close()
#define putc(__c, __stream) fputc(__c, __stream)
#define putchar(__c) fputc(__c, stdout)
#define getc(__stream) fgetc(__stream)
#define getchar() fgetc(stdin)
stdinβ(__iob[0])β your standard input, bestie. stream number zero.stdoutβ(__iob[1])β standard output. where yourprintfrizz goes.stderrβ(__iob[2])β standard error. the drama channel, stream two.EOFβ(-1)β end-of-file marker. the "we're so done here" of streams.fdev_set_udata(stream, u)βdo { (stream)->udata = u; } while(0)β sets the user data on a stream. yes it's ado { } while(0), that's just how macros stay safe inifstatements, periodt.fdev_get_udata(stream)β((stream)->udata)β grabs that user data right back out.fdev_setup_stream(stream, put, get, rwflag)β sets up a stream with your own put/get hooks and a read/write flag._FDEV_SETUP_READβ__SRDβ the "read only" flag vibe._FDEV_SETUP_WRITEβ__SWRβ the "write only" flag vibe._FDEV_SETUP_RWβ(__SRD|__SWR)β both flags at once. biiiidirectional, we love a versatile icon._FDEV_ERRβ(-1)β generic device error return._FDEV_EOFβ(-2)β end-of-file return for your custom device.FDEV_SETUP_STREAM(put, get, rwflag)β the convenience macro for setting up a stream with your put/get functions.fdev_close()β the close-out macro.putc(__c, __stream)βfputc(__c, __stream)β throws one character at a stream.putchar(__c)βfputc(__c, stdout)β throws one character atstdout.getc(__stream)βfgetc(__stream)β snags one character from a stream.getchar()βfgetc(stdin)β snags one character fromstdin.
π¦ Typedefs
typedef struct __file FILE
FILEβ the one and only.FILEis just a little nickname forstruct __file, and it's the type every single stream function below is obsessed with. main character type, fr fr. π
π Functions
the whole squad. every single one, no skips, no cuts:
int fclose (FILE *__stream)β shuts a stream down.int vfprintf (FILE *__stream, const char *__fmt, va_list __ap)βfprintf, but taking ava_listinstead of....int vfprintf_P (FILE *__stream, const char *__fmt, va_list __ap)β same thing, but__fmtlives in program memory (_P= the PROGMEM girlies π).int fputc (int __c, FILE *__stream)β writes one character to a stream.int printf (const char *__fmt,...)β the formatting legend. prints tostdout.int printf_P (const char *__fmt,...)βprintfwith the format string in program memory.int vprintf (const char *__fmt, va_list __ap)βprintfwith ava_list.int sprintf (char *__s, const char *__fmt,...)β formats straight into a string__s.int sprintf_P (char *__s, const char *__fmt,...)β same, format string in program memory.int snprintf (char *__s, size_t __n, const char *__fmt,...)β formats into__s, but caps it at__nbytes. the responsible one.int snprintf_P (char *__s, size_t __n, const char *__fmt,...)β same, program-memory format string.int vsprintf (char *__s, const char *__fmt, va_list ap)βsprintfwith ava_list.int vsprintf_P (char *__s, const char *__fmt, va_list ap)βsprintfwith ava_listand a program-memory format string.int vsnprintf (char *__s, size_t __n, const char *__fmt, va_list ap)βsnprintfwith ava_list.int vsnprintf_P (char *__s, size_t __n, const char *__fmt, va_list ap)βsnprintfwith ava_listand a program-memory format string.int fprintf (FILE *__stream, const char *__fmt,...)β formats and writes to a stream.int fprintf_P (FILE *__stream, const char *__fmt,...)β same, format string in program memory.int fputs (const char *__str, FILE *__stream)β writes a string to a stream.int fputs_P (const char *__str, FILE *__stream)β same, string in program memory.int puts (const char *__str)β writes a string tostdout.int puts_P (const char *__str)β same, string in program memory.size_t fwrite (const void *__ptr, size_t __size, size_t __nmemb, FILE *__stream)β writes__nmembitems of__sizebytes from__ptrinto a stream.int fgetc (FILE *__stream)β reads one character from a stream.int ungetc (int __c, FILE *__stream)β pushes a character back onto a stream. reverse uno card. πchar * fgets (char *__str, int __size, FILE *__stream)β reads up to__sizecharacters into__strfrom a stream.char * gets (char *__str)β reads into__str. (iykyk, be careful out here.)size_t fread (void *__ptr, size_t __size, size_t __nmemb, FILE *__stream)β reads__nmembitems of__sizebytes into__ptrfrom a stream.void clearerr (FILE *__stream)β clears the error and end-of-file indicators on a stream.int feof (FILE *__stream)β is this stream at end-of-file? vibe check. β¨int ferror (FILE *__stream)β did this stream error out?int vfscanf (FILE *__stream, const char *__fmt, va_list __ap)βfscanf, but with ava_list.int vfscanf_P (FILE *__stream, const char *__fmt, va_list __ap)β same, format string in program memory.int fscanf (FILE *__stream, const char *__fmt,...)β reads and parses from a stream.int fscanf_P (FILE *__stream, const char *__fmt,...)β same, program-memory format string.int scanf (const char *__fmt,...)β reads and parses fromstdin.int scanf_P (const char *__fmt,...)β same, format string in program memory.int vscanf (const char *__fmt, va_list __ap)βscanfwith ava_list.int sscanf (const char *__buf, const char *__fmt,...)β parses out of the string__buf.int sscanf_P (const char *__buf, const char *__fmt,...)β same, program-memory format string.int fflush (FILE *stream)β flushes a stream. let it all out, bestie. π
lowkey important: this page is just the roster. for what each function actually does, the argument rules, the return values, the edge cases β go read that function's own man page. don't come for me, I just work here. π«Ά
π Author
Generated automatically by Doxygen for avr-libc from the source code. (yes, a robot wrote my bio and honestly? slay. π€β¨)
Version 2.1.0 Β· Sat Jan 29 2022 Β· that's the avr-libc era this page was born in, and that's the whole vibe check. mwah. π ππ
π¦ where this page comes from
- fedora 43: avr-libc 2.2.1-3.fc43 Β· BSD-3-Clause
- fedora 44: avr-libc 2.2.1-5.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: avr-libc 2.1.0-bp160.1.33 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms