outtextxy怎么打印整数?

0

自动转型char了,请问怎么打印整数

ava
Jv

2020-7-4

0

在 outtextxy 函数的帮助里面,有范例代码输出整数,请参考:https://docs.easyx.cn/outtextxy

ava
慢羊羊

2020-7-5

0

可以先新建一个char型字符串数组array,然后通过sprintf_s将整数输入到array中,再新建一个TCHAR型字符串数组Tarray,将char型的array转化成TCHAR型的Tarray,再使用outtextxy输出Tarray

char转化TCHAR函数如下

#include<graphics.h>
#include<conio.h>
#include<stdio.h>
#include<tchar.h>

void CharToTCHAR(const char* _char, TCHAR* tchar)
{
	int iLength;

	iLength = MultiByteToWideChar(CP_ACP, 0, _char, strlen(_char) + 1, NULL, 0);
	MultiByteToWideChar(CP_ACP, 0, _char, strlen(_char) + 1, tchar, iLength);
}
ava
我不廉价

2020-7-4

直接使用 swprintf_s 将整数输出到 wchar_t 数组,就不需要后面的转换了。 -  慢羊羊  2020-11-21
技术讨论社区