如何在 C 语言中使用 write 函数从扩展的 ascii 打印字符 128?
#include <unistd.h>
int main(void)
{
int c;
c = 128;
write(1, &c, 1);
return(0);
}
输出:
Ascii 扩展 128:Ç
最佳答案
使用wchar_t
:
#include <stdio.h>
#include <wchar.h>
#include <locale.h>
int main(void)
{
wchar_t c;
setlocale(LC_ALL, "");
for (c = 128; c < 256; c++) {
wprintf(L"%lc\n", c);
}
return 0;
}
关于c - 使用写入功能打印扩展的 ascii,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47421144/