Advertisement
RicardasSim

trying wcwidth

Jun 21st, 2023
811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <locale.h>
  2. #include <stdio.h>
  3.  
  4. #define __USE_XOPEN 1
  5.  
  6. #include <wchar.h>
  7.  
  8. int   main(void)
  9. {
  10.     setlocale(LC_CTYPE, "en_US.UTF-8");
  11.  
  12.     wchar_t wch = L'❤';
  13.  
  14.     printf("%lc %d\n", wch, wcwidth(wch));
  15.  
  16.     return   0;
  17. }
  18.  
  19. /*
  20. output:
  21.  
  22. ❤ 1
  23.  
  24. */
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement