You are not logged in.
Lost Password?

Register To Post

 Bottom   Previous Topic   Next Topic

Converting integers to strings and Cls
Posted on: 2009/12/29 17:02
PVB Elite
Joined 2008/12/28
636 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributor10+ Game RatingsLong Time User (11 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
Two questions:

1. How can I convert an integer to a string without having to use an ugly hack like this:

char x_str

My libgccvb.h doesn't have itoa(), so that's what I've been using.

2. I need a better way of clearing the screen of text than this:

int Cls 
= -1;
i++;                //that's 48 spaces right there
vbTextOut(00i"                                                ");

Re: Converting integers to strings and Cls
Posted on: 2009/12/29 20:32
Joined 2000/1/8
2541 Posts
Highscore Top10Highscore Top ScoreCoder#1 PosterHOTY09 1stLong Time User (15 Years) App Coder90+ Game Ratings
Why not just copy over itoa from a newer version of libgccvb? :)

Re: Converting integers to strings and Cls
Posted on: 2009/12/29 21:43
PVB Elite
Joined 2003/7/26
1471 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
I don't think the code you posted is ugly... It's a little limited, but perfectly serviceable.

If you can't find itoa() or want even more text formatting power, you could use dasi's posprintf() port: ... ost_id=6529#forumpost6529

And as for clearing text, just use setmem() on the BGMap segment you're using for text output. Something like:

(BGMMBase + (row 128 column 2), 0, <string length 2>);

Where BGMMBase = 0x20000 (in case it's not defined in your libgccvb.h).

You could wrap it in a "cls()" function, if you like.

 Top   Previous Topic   Next Topic

Register To Post