std::putwchar(3)
πΈ std::putwchar(3) β C++ Standard Libary energy πΈ
okay so real talk, bestie, you're reading the std::putwchar(3) page, and yes β the manual section literally says "C++ Standard Libary" up there in the header. not a typo I made, that's just how it's spelled, and honestly? we respect the chaos. π
β¨ NAME β¨
std::putwchar β it's literally std::putwchar, that's the whole name, we're not doing a whole dramatic subtitle here π
β¨ SYNOPSIS β¨
okay so first up, it lives right here:
Defined in header <cwchar>
and the signature is exactly this, no cap:
std::wint_t putwchar( wchar_t ch );
Writes a wide characterchtostdout.
that's it. that's the function. one wide char, straight to stdout, main character behavior β¨
β¨ PARAMETERS β¨
chβ the wide character you want to be written. that's it. that's the whole parameter. give her the char, she does the thing π¦
β¨ RETURN VALUE β¨
chon success π (she returns the very character you fed her, iconique)WEOFon failure π
β¨ EXAMPLE β¨
// Run this code β go off, copy it, run it, live your truth:
#include <clocale>
#include <cstdio>
#include <cstdlib>
#include <cwchar>
#include <initializer_list>
int main()
{
std::setlocale(LC_ALL, "en_US.utf8");
for (const wchar_t ch : {
L'\u2200', // Unicode name: "FOR ALL"
L'β',
L'\n'
})
if (std::putwchar(ch) == WEOF)
{
std::puts("I/O error in std::putwchar");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
lowkey notice how the loop bails out the secondstd::putwchar(ch) == WEOFhits β then it printsI/O error in std::putwcharwithstd::putsand returnsEXIT_FAILURE. if everything slays, you getEXIT_SUCCESS. periodt π
β¨ POSSIBLE OUTPUT β¨
ββ
that's right, two of them β one from the L'\u2200' and one from the L'β', and the L'\n' did a little invisible goodbye at the end π
β¨ SEE ALSO β¨
putcharβ writes a character tostdout. (function) πfputwcβ writes a wide character to a file stream. π₯putwcβ (function) bestie, she's right there π- C documentation for
putwcharβ the C side of the story π§
okay and before you go, sources & date check because we stan a documented page: this one's from http://cppreference.com, dated 2024.06.10, and it's the std::putwchar(3) page β now go write some wide characters, you absolute icon π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms