[solved] trying to test if a qchar is equal to "[" and I get thrown a between pointer and integer error



  • Durhur...erp

    =='['

    Old Post
    @
    Error:
    C:\Dev\DiffMatchPatch\diffmatchpatch.cpp:303: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    @
    on this line specifically:
    @
    if (character.toLatin1() == "[")
    @
    FULLCODE:
    @
    QString line = in.readLine();
    while (!in.atEnd())
    {
    line = in.readLine();

    //Read Character's if length !=0
    int charPosition = 0;
    //while (line.length())
    while (charPosition <= line.length())
    {
        //const QChar character = QString::operator [](charPosition) line;
    
        //const QChar character = QString::
    
        //QChar character = line[](charPosition);
    
        QChar character = line[charPosition];
    
        //string conversion?
        //http://qt-project.org/faq/answer/how_can_i_convert_a_qstring_to_char_and_vice_versa
        //QString characterString = character.toLatin1();
    
        if (character.toLatin1() == "[")
        {
            bracketCount++;
        };
        charPosition++;
    }
    
    
    lineCount++;
    

    }
    in.resetStatus();
    @


Log in to reply
 

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