C++编译后中文显示是??号
void DrawT(int X, int Y, CColor Color, int Font, bool Center, char* _Input, ...)
{
char Buffer[1024] = { '\0' };
/* set up varargs*/
va_list Args;
va_start(Args, _Input);
vsprintf_s(Buffer, _Input, Args);
va_end(Args);
size_t Size = strlen(Buffer) + 1;
/* set up widebuffer*/
wchar_t* WideBuffer = new wchar_t[Size];
/* char -> wchar */
mbstowcs_s(nullptr, WideBuffer, Size, Buffer, Size - 1);
/* check center */
int Width = 0, Height = 0;
if (Center)
{
GetTextSize(Font, WideBuffer, Width, Height);
}
/* call and draw*/
DrawSetTextColor(Color._color[0], Color._color[1], Color._color[2], Color._color[3]);
DrawSetTextFont(Font);
DrawSetTextPos(X - (Width / 2), Y);
DrawPrintText(WideBuffer, wcslen(WideBuffer));
return;
}
void DrawString(int font, int x, int y, int align, CColor color, const wchar_t* text, ...)
{
DrawSetTextPos(x, y);
DrawSetTextColor(color._color[0], color._color[1], color._color[2], color._color[3]);
DrawSetTextFont(font);
DrawPrintText(text, wcslen(text));
return;
}这个是代码
...全文
相关推荐
VScode编译C++ 头文件显示not found的问题
知识点2: VScode编译C++ 头文件显示not found的问题当我们在VScode中编译C++代码时,可能会遇到头文件显示not found的问题。
Dev-CPP5.10中文版本(自带编译器,安装即用)
Dev-CPP5.10是针对C++编程的一款集成开发环境,特别适合初学者和专业开发者。这个中文版本包含了编译器,使得用户无需额外安装就能立即开始编程工作。
yaml-cpp库的编译&安装
**yaml-cpp库的编译与安装指南**yaml-cpp是一个用C++编写的YAML解析器和生成器库,广泛应用于配置文件处理和数据序列化。
Dev-Cpp C++编译器
标题中的“Dev-Cpp C++编译器”指的是这个IDE的核心功能,即它内置了C++编译器,使得用户能够直接在该环境中创建和管理C++项目。
Embarcadero Dev-C++ 编辑器中文不显示和乱码问题
修改文件的默认编码为utf-8,菜单栏:Tools > Editor Options... > New Document Encoding 选择 UTF-8。菜单栏:Tools > Editor Options... > Fonts, 取消勾选<ID 27071 translation missing>。使用 Embarcadero Dev-C++ 编译器时,代码中的中文只有鼠标选中其所在行时才会显示,否则看不见。添加 -fexec-charset=gbk 命令行,重新编译运行。运行时,会显示乱码。


