InputBox的char*类型实参与LPTSTR类型的形参不兼容

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

int main()
{
	// 初始化绘图窗口
	initgraph(640, 480);

	// 定义字符串缓冲区,并接收用户输入
	char s[10];
	InputBox(s, 10, _T("请输入半径"));

	// 将用户输入转换为数字
	int r;
	sscanf(s, "%d", &r);

	// 画圆
	circle(320, 240, r);

	// 按任意键退出
	_getch();
	closegraph();
}

输入的是官网文档的代码也报错,我的是VC2019

ava
雷雨阵阵

2020-7-28

1

你贴出的代码是针对 ANSI 编码的示例。可以对应的修改为 Unicode 版本。

或者参考最新的官网帮助里面的示例:https://docs.easyx.cn/InputBox

ava
慢羊羊

2020-7-28

技术讨论社区