Jump to content

C++ Strings (%u etc)


Guest xeross

Recommended Posts

Hey,

Im working on a script myself atm and i need to put a variable into a query i have the following code :

QueryResult *result = WorldDatabase.PQuery("SELECT `text`, `next` FROM `autobroadcast` WHERE `id` = %u", nextid);

Now i want to know what do the %u etc mean and how do i use them properly.

The variable nextid has been set btw.

Also i've assigned nextid to be a uint32 but it will never reach a number higher then 32 or so what is the best variable type to use for it ?

Thanks for your time, Xeross

Link to comment
Share on other sites

Hey,

Im working on a script myself atm and i need to put a variable into a query i have the following code :

QueryResult *result = WorldDatabase.PQuery("SELECT `text`, `next` FROM `autobroadcast` WHERE `id` = %u", nextid);

Now i want to know what do the %u etc mean and how do i use them properly.

The variable nextid has been set btw.

Also i've assigned nextid to be a uint32 but it will never reach a number higher then 32 or so what is the best variable type to use for it ?

Thanks for your time, Xeross

%u is unsigned int = uint32

%s = string

and so on..

Link to comment
Share on other sites

Hey,

Im working on a script myself atm and i need to put a variable into a query i have the following code :

QueryResult *result = WorldDatabase.PQuery("SELECT `text`, `next` FROM `autobroadcast` WHERE `id` = %u", nextid);

Now i want to know what do the %u etc mean and how do i use them properly.

The variable nextid has been set btw.

Also i've assigned nextid to be a uint32 but it will never reach a number higher then 32 or so what is the best variable type to use for it ?

Thanks for your time, Xeross

Standard C formatting ..

http://www.cplusplus.com/reference/clibrary/cstdio/printf.html

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use