samedi 23 février 2019

How to make a non-static callback in c++ for sqlite?

I have some code that gets data from a database and stores it in a struct but I get an error "reference to non-static member function must be called".

class ScoreManagement {

private:
    int callback(void *NotUsed, int argc, char **argv, 
                char **azColName) {

        NotUsed = 0;


        playerRecords[player_number].name =  argv[1] ? argv[1] : "NULL";

        player_number++
        return 0;
    }

    void showScore(string userinput) {
        string query = "SELECT * FROM SCORES"; 

        sqlite3_exec(DB, query.c_str(), callback, NULL, NULL);

    }
};

Aucun commentaire:

Enregistrer un commentaire