Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / printing numbers on the screen

Author
Message
Grenadiac111
14
Years of Service
User Offline
Joined: 23rd Dec 2009
Location:
Posted: 14th Jan 2010 03:58
im trying to display a players score on the screen dbText. every time i try to get the integer to be displayed but i always get an error message like cannot convert char to char *. can someone please tell me how to display the score. for refference the integer i need to display is called Score and like i said is declared as an int type.
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 14th Jan 2010 05:18
Show me the code your using and i can most likely show you a solution.

When you declare your score make it a char * in the first place. Or if its of another type use the commands i provide below.

if your score variable is a int use:
dbStr(score)

if your score is a string use
(char *)score.c_str()

If you cannot get it working provide your erroring code and i will try to fix it.

www.touchofdeathproductions.com
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 14th Jan 2010 13:00
best way is sprintf in my opinion:


http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/
for reference

notice that if you are storing the score in a float, or anything except an integer, you should change %d to the one fits with the variable type, see the link above for a list of the %'s

Grenadiac111
14
Years of Service
User Offline
Joined: 23rd Dec 2009
Location:
Posted: 14th Jan 2010 22:44
Thanks ive got the score displaying now

Login to post a reply

Server time is: 2024-10-01 20:28:09
Your offset time is: 2024-10-01 20:28:09