显示≥和≤ C 应用程序中的 ASCII 字符

发布于 2024-08-09 02:55:58 字数 182 浏览 4 评论 0原文

我目前正在编写一个 C 应用程序,需要在终端中显示以下符号:

它们的 ASCII 字符代码是 242243 但我无法让它们显示在 DOS 终端中。

关于我如何做到这一点有什么想法吗?

I am currently writing a C application and I need to display the following symbols in the terminal : and

Their ASCII character codes are 242 and 243 but I can't get them to be displayed in the DOS terminal.

Any ideas on how I can do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

大姐,你呐 2024-08-16 02:55:58

例如,它们既不是 ASCII 也不是 LATIN1。

These are not in ASCII nor in LATIN1 for instance.

吾家有女初长成 2024-08-16 02:55:58
printf("\xf2\n");

如果这不起作用,那是因为 DOS 和代码页的原因。尝试使用 CHCP 命令。您正在步入区域设置/特定于平台/立即放弃的领域。

printf("\xf2\n");

If that doesn't work, it's because of DOS and code pages. Try playing with the CHCP command. You're strolling into locales/platform-specific/give-up-now territory.

暮凉 2024-08-16 02:55:58

什么DOS终端?如果您在 Windows 下编译为 32 位(或 64 位)二进制文件(我确信您是这样),那么它只是一个控制台窗口。

我相信是最简单的设置方法控制台窗口的代码页。使用代码页 437 还是 unicode 代码页(例如 UTF-8,即 65001)由您决定,但我建议使用 Unicode,因为如果您稍后需要它,它将为您提供更大的灵活性。

What DOS terminal? If you're compiling to a 32-bit (or 64-bit) binary under Windows, as I'm sure you are, then it's just a console window.

I believe this is the simplest way to set the code page of a console window. It's up to you whether to use code page 437 or a unicode code page (such as UTF-8, which is 65001), but I would suggest Unicode as it will give you more flexibility if you need it later.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文