gpt4 book ai didi

c++ - winforms 应用程序 String^ 到 int

转载 作者:太空宇宙 更新时间:2023-11-04 12:44:17 26 4
gpt4 key购买 nike

我正在使用带有 C++ 的 Windows 窗体应用程序。

我想将 String^ 转换为 int

我的代码是:

int number = std::stoi(TextBox1->Text);

但错误显示:

no instance of overloaded function "std::stoi" matches the argument list argument types are :(System:: String ^)

String 前面的 ^ 是什么意思?

最佳答案

试试这个:

int number = std::stoi(std::wstring(TextBox1->Text->Data()));

关于c++ - winforms 应用程序 String^ 到 int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52495001/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com