I am doing some serial port communcation to a computer controlled pump and the createfile function I used to communicate requires the com port name to be parsed as a wchar_t pointer.
I am also using QT to create a form and aquire the com port name as a QString.
This QString is converted to a char array and pointed to as follows:
char* Dialog::GetPumpSerialPortNumber(){
QString mystring;
mystring = ui->comboBox_2->currentText();
char * mychar;
mychar = mystring.toLatin1().data();
return mychar;
I now need to set my port number which is stored as a wchar_t* in my pump object. I do this by calling the following function:
void pump::setPortNumber(wchar_t* portNumber){
this->portNumber = portNumber;
}
Thus how do I change my char* (mychar) into a wchar_t* (portNumber)?
Thanks.