libwget-printf(3)

πŸ’– libwget-printf β€” Libwget printf functions πŸ’–

okay bestie, welcome to the Library Functions Manual section for libwget-printf, and lemme tell you, this one is a whole vibe. it's the printf glow-up, and we're gonna go through every single function like it's a group chat roll call. no skipping, no skimming, we eat the whole plate. πŸ“


✨ SYNOPSIS ✨

πŸŽ€ Functions

size_t wget_vasprintf (char **strp, const char *fmt, va_list args)
size_t wget_asprintf (char **strp, const char *fmt,...)
char * wget_vaprintf (const char *fmt, va_list args)
char * wget_aprintf (const char *fmt,...)
size_t wget_vfprintf (FILE *fp, const char *fmt, va_list args)
size_t wget_fprintf (FILE *fp, const char *fmt,...)
size_t wget_printf (const char *fmt,...)
size_t wget_vsnprintf (char *str, size_t size, const char *fmt, va_list
    args)
size_t wget_snprintf (char *str, size_t size, const char *fmt,...)

🌈 Detailed Description 🌈

so basically, this is a collection of printf-style functions that are used with libwget and/or Wget2 code. that's their home base, their main character arc. πŸ’…

and the tea is: they may be useful to other developers too, which is literally why they are exported. they said "sharing is caring" and honestly? iconic. πŸ‘‘


πŸ¦‹ Function Documentation πŸ¦‹

πŸ’œ size_t wget_vasprintf (char ** strp, const char * fmt, va_list args)

Parameters

  • strp β€” Pointer to hold the string output
  • fmt β€” Printf-like format specifier
  • args β€” va_list of arguments

Returns

Length of the string returned via strp or (size_t) -1 on error

Prints arguments to allocated memory and 0-terminates it. The string is returned via the first argument. It has to be free()'d by the caller when it is no longer needed.

bestie please remember the free() β€” that memory is yours to clean up, the library is not your maid. 🧹

πŸ’œ size_t wget_asprintf (char ** strp, const char * fmt, ...)

Parameters

  • strp β€” Pointer to hold the string output
  • fmt β€” Printf-like format specifier
  • ... β€” List of arguments

Returns

Length of the string returned via strp

Prints arguments to allocated memory and 0-terminates it. The string is returned via the first argument. It has to be free()'d by the caller when it is no longer needed.


πŸ’œ char * wget_vaprintf (const char * fmt, va_list args)

Parameters

  • fmt β€” Printf-like format specifier
  • args β€” va_list of arguments

Returns

Pointer to 0-terminated string in memory

Prints arguments to memory and returns a pointer to allocated and 0-terminated chunk of memory. The return value has to be free()'d by the caller when it is no longer needed.


πŸ’œ char * wget_aprintf (const char * fmt, ...)

Parameters

  • fmt β€” Printf-like format specifier
  • ... β€” List of arguments

Returns

Pointer to 0-terminated string in memory

Prints arguments to memory and returns a pointer to allocated and 0-terminated chunk of memory. The return value has to be free()'d by the caller when it is no longer needed.


πŸ’œ size_t wget_vfprintf (FILE * fp, const char * fmt, va_list args)

Parameters

  • fp β€” FILE pointer
  • fmt β€” Printf-like format specifier
  • args β€” List of arguments

Returns

Number of bytes written or -1 on error

Prints arguments to stream fp and returns number of bytes written.


πŸ’œ size_t wget_fprintf (FILE * fp, const char * fmt, ...)

Parameters

  • fp β€” FILE pointer
  • fmt β€” Printf-like format specifier
  • ... β€” List of arguments

Returns

Number of bytes written or -1 on error

Prints arguments to stream fp and returns number of bytes written.


πŸ’œ size_t wget_printf (const char * fmt, ...)

Parameters

  • fmt β€” Printf-like format specifier
  • ... β€” List of arguments

Returns

Number of bytes written or -1 on error

Prints arguments to stdout and returns number of bytes written.


πŸ’œ size_t wget_vsnprintf (char * str, size_t size, const char * fmt, va_list args)

Parameters

  • str β€” Destination buffer
  • size β€” Size of str
  • fmt β€” Printf-like format specifier
  • args β€” List of arguments

Returns

Number of bytes written, or, on truncation, that would have been written

Prints arguments to buffer str and returns number of bytes written, or on truncation: that would have been written.

If str is NULL the return value are the number of bytes that would have been written.

okay this one's actually so useful β€” you can pass NULL to ask "how big does my buffer need to be?" and it tells you. main character energy fr fr. ✨

πŸ’œ size_t wget_snprintf (char * str, size_t size, const char * fmt, ...)

Parameters

  • str β€” Destination buffer
  • size β€” Size of str
  • fmt β€” Printf-like format specifier
  • ... β€” List of arguments

Returns

Number of bytes written, or, on truncation, that would have been written

Prints arguments to buffer str and returns number of bytes written, or on truncation: that would have been written.

If str is NULL the return value are the number of bytes that would have been written.


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for wget2 from the source code.


okay that's the whole page, you understood all of it, slay. πŸ’– this came to you straight from wget2, Version 2.3.0, no cap β€” go forth and printf responsibly, bestie. πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from