'C99 wprintf UTF-16 not aligned
I am writing a C99 console program, using UTF-16, and I need to align the characters, however, using wprintf, the characters are not the same width.
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <fcntl.h>
#include <io.h>
int main() {
_setmode(_fileno(stdout), _O_U16TEXT);
wprintf(L"%-10.1ls%ls\n", L"\u2654", L"hello");
wprintf(L"%-10.1ls%ls\n", L"h", L"hello");
}
♔ Hello
h Hello
I would like to be able to align perfectly the second text (here 'hello').
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
