How to use QString object in string operations.??



  • Hello,
    I want to use QString in string operations like say strCpy (char *dest, const char *source).
    i have a normal array @string1[10]@ as destination and QString string2 as source.

    It gives me error, that QString can't be converted to char *, even though i used string2.constData().

    any solution.??

    [[moved from Qt Quick forum, Tobias]]


  • Moderators

    Might be that const data is too const for the compiler here :) Make a copy of it, or use QString::toUtf8().data().

    Or just use QStrings only, they are powerful.



  • Try to convert to Utf8 and then take pointer to char
    @
    string2.toUtf8().constData()
    @


Log in to reply
 

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