# std::putwchar

> C++ Atlas: `cppatlas.com/w/cpp/io/c/putwchar` | Source: https://en.cppreference.com/w/cpp/io/c/putwchar | Domain: Input/output

Writes a wide character ch to stdout.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <cwchar>
std::wint_t putwchar( wchar_t ch );
```

Writes a wide character `ch` to `stdout`.

### Parameters

- `ch` - wide character to be written

### Return value

`ch` on success, `WEOF` on failure.

### Example

```cpp
#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;
}
```

Possible output:

```text
∀∀
```

### See also

- [`putchar`](https://en.cppreference.com/w/cpp/io/c/putchar): writes a character to `stdout` (function)
- [`fputwc`](https://en.cppreference.com/w/cpp/io/c/fputwc), [`putwc`](https://en.cppreference.com/w/cpp/io/c/fputwc): writes a wide character to a file stream (function)
- [C documentation for `putwchar`](https://en.cppreference.com/w/c/io/putwchar)

---
Attribution: content from https://en.cppreference.com/w/cpp/io/c/putwchar (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.