为什么这段代码在VS2022,显示“outtextxy”: 没有重载函数可以转换所有参数类型
outtextxy 函数应该怎么输出string?
#include <graphics.h>
#include<string>
int main()
{
std::string abc = "hdfdd";
initgraph(600, 600);
outtextxy(200, 200, abc.c_str());
while (1);
}
为什么这段代码在VS2022,显示“outtextxy”: 没有重载函数可以转换所有参数类型
outtextxy 函数应该怎么输出string?
#include <graphics.h>
#include<string>
int main()
{
std::string abc = "hdfdd";
initgraph(600, 600);
outtextxy(200, 200, abc.c_str());
while (1);
}
默认情况下,vs 的项目是 unicode 编码。所以,你应该使用 wstring。
如果要使用 string,请修改项目编码为 MBCS。
建议使用 wstring。