I have a function which looks like below and I am trying to print out the values in QT.
void myfunction(
std::string& Service,
std::string& Type,
std::string& Hostname,
std::string& Address,
UNUM16 Port,
std::map< std::string, std::string >& TxtList )
{
qDebug() << "Hostname capacity is : " << Hostname.capacity();
qDebug() << "Hostname is : " << QString::fromStdString(Hostname);
qDebug() << "Port is : " << ntohs(Port);
std::map< std::string, std::string >::iterator iter;
iter = TxtList.find("FwVersion");
}
Now when I run the function, first debug statement prints the correct value for capacity of string. But the second debug statement does not work and it just prints empty string. And also the when I do the find on map, the application just crashes.
I have also tried QString::fromUtf8(Hostname.c_str()) function and even that did not work
Is there anyway to convert the values and print them in QT?