I'm writing a QT Console Application to write out of an FTDI cable using the QSerialport library. (the FTDI cable is connected to a logic analyzer so I can debug the output)
I need to pass int x = 255;
to the line myserial->putChar();
I tried to convert the int to a char using:
int x = 255;
std::string s = std::to_string(x);
char const *myChar = s.c_str();
myserial->putChar(myChar);
and received the error:
cannot initialize a parameter of type 'char' with an lvalue of type 'const char*'
However in this test starting with a char everything works perfectly:
char myChar = 255;
myserial->putChar(myChar);
Giving the correct result of 0xFF
on the logic analyzer.
Can anyone help? Thanks!