outtextxy函数无法输出中文

0

在使用outtextxy时,无法输出wchat_t类型的字符串

报错为: [Error] invalid conversion from 'wchar_t*' to 'TCHAR' {aka 'char'} [-fpermissive]

#include<graphics.h>
#include<conio.h>
using namespace std;

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	initgraph(1280,720,EX_SHOWCONSOLE);
	wchar_t s[] = L"你好世界";
	outtextxy(10, 20,s);
	_getch();

	//fclose(stdin);
	//fclose(stdout);
    return 0;
}

ava
StevenLi

2022-11-19

0

把字符集改成 Unicode 然后再试下这样的代码

#include<graphics.h>
#include<conio.h>
using namespace std;

int main() 
{
	
	initgraph(500, 520);
	// wchar_t s[] = L"你好世界";
	outtextxy(10, 20, _T("你好世界"));
	
	_getch();
	closegraph();
	
	return 0;
}
ava
Margoo

2022-11-19

使用unicode字符集编译报错,使用utf-8字符集输出仍是乱码 -  StevenLi  2022-11-19
这样吧你一个个去试,在 unicode 下 有两种编译器 一个是 debug 一个是release  每个编译器有两种位数一个X86 一个X64,把他们所以的组合试卷下编译看哪个能通过? -  Margoo  2022-11-19
项目没有 utf-8 字符集,你可能混淆了项目的字符集设置和文件的编码。 -  慢羊羊  2022-11-19
技术讨论社区