win 表单应用程序字符串^ 到 int
win forms application String^ to int
我正在使用带有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++ 到 C 的映射<字符串、int>#
- 构造<int>具有 2 个字符串文字的向量
- 字符串中int的加法运算
- C++,在int数组中输入字符串或字符会输出0,而不是ascii或error
- cin >> int 给定一个字符串将 int 赋值为 0
- 将字符串中的 int 转换为字母;
- 使用 switch,但我想用字符串而不是 int 进行选择
- 两个数组,int 和 string,如何显示带有对应 int 的字符串?
- 从字符串流中读取具有特定字段宽度的 int
- win 表单应用程序字符串^ 到 int
- C++程序在将 int 与 cin 一起使用时有效,但不能使用字符串
- 将子字符串字符从字符串值转换为 int,然后将其分配给 int 变量
- 将字符串转换为 int 后的随机值
- 如何检查字符串是否正确以将其转换为 int?
- 在乌鸦中获取非Int(字符串)URL资源ID
- 如何使 int 字符串中的每个输入都成为一位数
- 将无符号int+字符串强制转换为无符号char向量
- 如何在C++中连接字符串+int+字符串
- 如何在消息框中使用int字符串?
- 如何在C++中将向量转换为<int>字符串