| | |
string to int
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Mar 2008
Posts: 1,411
Reputation:
Solved Threads: 114
try
C++ Syntax (Toggle Plain Text)
Int32::Parse(stringname)
C++/CLI handles boxing and unboxing implicitly. Either of these work just peachy:
C++ Syntax (Toggle Plain Text)
using namespace System; #include <iostream> int main() { String^ s = "123"; int x = Convert::ToInt32(s); std::cout << x * x << '\n'; }
C++ Syntax (Toggle Plain Text)
using namespace System; #include <iostream> int main() { String^ s = "123"; int x = Int32::Parse(s); std::cout << x * x << '\n'; }
If at first you don't succeed, keep on sucking until you do succeed.
•
•
Join Date: Feb 2008
Posts: 98
Reputation:
Solved Threads: 2
Thanks, but new issue.
error C2664: 'System::IO:
orts:
erialPort:
erialPort(System::ComponentModel::IContainer ^)' : cannot convert parameter 1 from 'System::IO:
orts:
erialPort *' to 'System::ComponentModel::IContainer ^'
this should work but it is giving me a wierd error. There are seven different overloads for SerialPort() and I dont understand why it is interpreting it this way. Any suggestions? Thanks again.
I want to use the SerialPort(SYSTEM string^ portname, int baudrate)
C++ Syntax (Toggle Plain Text)
String^ comPort = "COM" + this->RS232CommPortNum->Value; int baudRate = Convert::ToInt32(this->cbBaudRate->ValueMember); SerialPort com = gcnew SerialPort(comPort, baudRate);
error C2664: 'System::IO:
orts:
erialPort:
erialPort(System::ComponentModel::IContainer ^)' : cannot convert parameter 1 from 'System::IO:
orts:
erialPort *' to 'System::ComponentModel::IContainer ^'this should work but it is giving me a wierd error. There are seven different overloads for SerialPort() and I dont understand why it is interpreting it this way. Any suggestions? Thanks again.
I want to use the SerialPort(SYSTEM string^ portname, int baudrate)
Last edited by Nemoticchigga; May 7th, 2008 at 12:10 pm.
gcnew creates a new managed reference object. You need to declare the variable holding the object as a managed reference:
C++ Syntax (Toggle Plain Text)
SerialPort^ com = gcnew SerialPort(comPort, baudRate);
If at first you don't succeed, keep on sucking until you do succeed.
![]() |
Similar Threads
- String to int (Java)
- Problems from string to int array (C)
- string to int conversion (C++)
- String to Int (C++)
Other Threads in the C++ Forum
- Previous Thread: help in phonebook
- Next Thread: Selecting where to start from when reading or writing text to a file.
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline google graph homeworkhelper iamthwee ifstream input int integer lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






