#Variable Printing in 'C'
9 messages in this thread
Hello All!
I am looking to try and find out how to print/append variables to the end
of my text strings (Intuitext). I can get all the text to print but need to
add some changing variables to the end…Can't seem to figure it out with
all my books so all you 'C' programmers HELP! 🙂 Thanks tim
Tim,
PrintIText() _only_ prints "text". There IS no formatting. You must
format your "variables" first and put them into a string. Probably the
simplest is to use sprintf() to do it.
Ok I may be lost in this one and will have to hit the books, but the jist
of what I want to do is….I am working on a baseball game with stats and
such and need to have something like:
Strikes: 0
where the zero would be the variable and would be say sr and would or could
change with each pitch and would reprint each time how could I have it
changed to a string and then print it beside or in line with the word
strike? Tim
try:
printf("Strikes: %1d",sr); Note that there is no '\n' to advance
the line, so the next print will print in exactly the same place. If you
ever have (by mistake, of course) more than 9 strikes, the above will fail
🙂
Larry Schilling
Ok Don't mean to come off wrong but I believe in my original message it
said that I am working with an Intuitext STructure for printing in a custom
window…so this will not work…any other ideas, pleaseeeeee! 🙂
tim
I don't understand the problem. sprintf() then point your IntuiText.IText
to that array.
-sja
Ya know Steve…I think you're right I don't understand the problem
either?! 🙂 That works for me….I am still wading my way through all
these books and figured it had to be something simple! Thanks for the push
in the right direction!
Tim
Tim, If you can structure your code a bit differently, there is a faster
way to achieve the same thing. sprintf() then use Move()/Text().
I will look into that….(Move()/TExt()) and see what it looks
like…Thanks for the input and I will talk to ya soon….
Tim