4

我无法打印欧元符号。我正在使用的程序如下。

我已将字符集设置为代码页 1250,其中 0x80 代表欧元符号。

程序
=======

#include <stdio.h>
#include <locale.h>

int main()
{
    printf("Current locale is: %s\n", setlocale (LC_ALL, ".1250"));
    printf("Euro character: %c\n", 0x80);
    getchar();
    return 0;
}

输出
======
当前语言环境是:English_India.1250
欧元字符:?

其他细节
=============
操作系统:Windows Vista
编译器:vc++ 2008 express edition

4

3 回答 3

3

阅读: http: //www.columbia.edu/~em36/wpdos/eurodos.html

有一些部分可以为您提供很多帮助:

  • 在全屏 DOS 和 Windows NT、2000 或 XP 的命令控制台中显示欧元符号
  • 在 DOS 和 Windows 2000 和 XP 的命令控制台窗口中显示欧元符号(对 TrueType 字体的内置支持)
  • 在 DOS 中显示欧元,在 Windows 2000 和 XP 中显示命令控制台(位图和 TrueType 字体)
于 2009-12-28T13:09:30.840 回答
3

0x80 字符被错误地声明为欧元符号,它是填充字符。见这里:http ://bugs.mysql.com/bug.php?id=28263

如果我没记错的话,它必须在 0x120 左右,尝试在从 120 到 130 的 for 循环中打印

于 2009-12-28T13:10:50.153 回答
1
#include <stdio.h>

int main()
{
 printf("\u20AC");
return 0;
}

我使用了 GCC 编译器,效果很好。输出为:€</p>


这仅适用于 C++ 和 C99

于 2009-12-28T14:20:08.093 回答