Problems with sqlite, integers, print and printf.
#1

Hi all,

I have a players table inside sqlite with the column id - PK NN AI.

I use db_get_field_assoc() to get the id value using my query result variable and set it to my players variable, like so:

Код:
enum playersInfo {
	pid
}

new players[MAX_PLAYERS][playersInfo];

// ...
// ...

if (db_num_rows(result) == 1) {
    db_get_field_assoc(result, "id", players[playerid][pid], 11);
}
Now come the tricky part, i want to debug the value so I call:

Код:
print(players[playerid][pid]); // prints 1, that's the correct id.

printf("id: %d\n", players[playerid][pid]); // prints id: 49 ... wth???
Why in the world is the printf function returning 49?

That's more interesting, if the id in the database is 2, it returns 50 from the printf function, and if the id is 10 it returns 59, but the print function always returns the right value.

Why is that Thanks for the help...
Reply


Messages In This Thread
Problems with sqlite, integers, print and printf. - by welderlourenco - 10.12.2014, 20:45
Re: Problems with sqlite, integers, print and printf. - by Raweresh - 10.12.2014, 21:19
Re: Problems with sqlite, integers, print and printf. - by welderlourenco - 10.12.2014, 21:30

Forum Jump:


Users browsing this thread: 1 Guest(s)