0

how can i do this:


_name__GetAvailable inp;

QString tmp;
inp.From = tmp;

this is definition of name_GetAvailable class:

class SOAP_CMAC _name__GetAvailable
{
public:
    std::string *From;  
    std::string *To;    
    struct soap *soap;  
}

I tried this :

inp.From = tmp.toStdString();

but i've got the following error:

C:\Qt2\Qt5.0.1\Tools\QtCreator\bin\Ticket\mainwindow.cpp:49: error: cannot convert 'std::string {aka std::basic_string}' to 'std::string* {aka std::basic_string*}' in assignment

gureedo
  • 315
  • 1
  • 11
DAkbariSE
  • 151
  • 1
  • 13

1 Answers1

3

If you want a std::string pointer, you need to allocate a new std::string :

inp.From = new std::string(tmp.toStdString());

But I really don't see the reason why you would need to manipulate std::string by pointer.

If OAP_CMAC _name__GetAvailable is yours, you could manipulate std::string by value :

class SOAP_CMAC _name__GetAvailable
{
public:
    std::string From;  
    std::string To;    
    struct soap *soap;  
}

Otherwise, don't forget to delete the std::string* From and To at some point.

zakinster
  • 10,508
  • 1
  • 41
  • 52
  • Thanks it worked I used gSOAP toolkit for creating some header and source files and now i'm using its class and functions and i cant change their definitions – DAkbariSE May 16 '13 at 08:28