Error while concatenating using QString.



  • Hi All,

    char emp_name[] = "XYZ";
    QString str = "employee name is: "+emp_name;

    When running this code, Error coming is : invalid operand of type const char to binary operator+.

    Kindly suggest how this error can be resolved..

    Regards,
    Anuj



  • @anuj-nogja said in Error while concatenating using QString.:

    Hi All,

    char emp_name[] = "XYZ";
    QString str = "employee name is: "+emp_name;

    When running this code, Error coming is : invalid operand of type const char to binary operator+.

    Kindly suggest how this error can be resolved..

    Regards,
    Anuj

     char emp_name[] = "XYZ";
     QString str = "employee name is: "+QString(emp_name);
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.