integer, printf: is there a way to write an integer as a wide char to console without locale.h?

StackOverflow https://stackoverflow.com/questions/6097735

  •  09-09-2020
  •  | 
  •  

Question

suppose I have a Unicode codepoint c (a uint32). Is there a way to print this integer to console (as a wide character) without using locale.h or wchar.h? Thanks.

Was it helpful?

Solution

You can try to use

printf("%lc", c);

though you really need to make sure that c is a wint_t (which requires wchar.h) rather than a uint32_t, even though the two are most likely the same type...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top