C语言 如何在C中使用扩展ASCII表的符号?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17362509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use symbols of extended ASCII table in C?
提问by yulian
I've been tried to print Extended ASCII characters:
我曾尝试打印扩展 ASCII 字符:
http://www.theasciicode.com.ar/
http://www.theasciicode.com.ar/
But all those symbols were printed as question-character on the white background ?.
但是所有这些符号都作为问号印在白色背景上?。
I use the following cycle to print that symbols:
我使用以下循环来打印该符号:
for (i = 0; i <= 30; i++)
printf("%c", 201);
Question:Is there any way to print those Extended ASCII charactersor not? Or maybe there is special library for these characters?
问题:有没有办法打印这些扩展 ASCII 字符?或者也许有这些角色的特殊库?
OS Linux Ubuntu 13.04, Code::Blocks 12.11 IDE.
操作系统 Linux Ubuntu 13.04,代码::块 12.11 IDE。
回答by Pieter van der Meer
It's better to use unicode than extended ASCII, which is non-standard. A thread about printing unicode characters in C : printing-utf-8-strings-with-printf-wide-vs-multibyte-string-literals
使用 unicode 比使用非标准的扩展 ASCII 更好。关于在 C 中打印 unicode 字符的线程: printing-utf-8-strings-with-printf-wide-vs-multibyte-string-literals
But indeed you need to copy paste unicode characters..
但确实你需要复制粘贴unicode字符..
A better way to start:
更好的开始方式:
#include <stdio.h>
int main() {
printf("\u2500\u2501\n");
}
See https://en.wikipedia.org/wiki/Box-drawing_character#Unicodefor unicode characters for this extended ASCII style box art..
请参阅https://en.wikipedia.org/wiki/Box-drawing_character#Unicode以了解此扩展 ASCII 样式框艺术的 unicode 字符。

