stdio.h(3)

πŸ“¦ version 2.2.1, in fedora 43, fedora 44, opensuse-leap 16.0

🌸 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 your printf rizz 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 a do { } while(0), that's just how macros stay safe in if statements, 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 at stdout.
  • getc(__stream) β†’ fgetc(__stream) β€” snags one character from a stream.
  • getchar() β†’ fgetc(stdin) β€” snags one character from stdin.

πŸ¦‹ Typedefs

typedef struct __file FILE
  • FILE β€” the one and only. FILE is just a little nickname for struct __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 a va_list instead of ....
  • int vfprintf_P (FILE *__stream, const char *__fmt, va_list __ap) β€” same thing, but __fmt lives 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 to stdout.
  • int printf_P (const char *__fmt,...) β€” printf with the format string in program memory.
  • int vprintf (const char *__fmt, va_list __ap) β€” printf with a va_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 __n bytes. 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) β€” sprintf with a va_list.
  • int vsprintf_P (char *__s, const char *__fmt, va_list ap) β€” sprintf with a va_list and a program-memory format string.
  • int vsnprintf (char *__s, size_t __n, const char *__fmt, va_list ap) β€” snprintf with a va_list.
  • int vsnprintf_P (char *__s, size_t __n, const char *__fmt, va_list ap) β€” snprintf with a va_list and 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 to stdout.
  • 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 __nmemb items of __size bytes from __ptr into 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 __size characters into __str from 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 __nmemb items of __size bytes into __ptr from 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 a va_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 from stdin.
  • int scanf_P (const char *__fmt,...) β€” same, format string in program memory.
  • int vscanf (const char *__fmt, va_list __ap) β€” scanf with a va_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