I need to print something on this form:
[1] "text" [2] "text" [3] "text"
I'm using strcat()
, so I want to concatenate "text" to a buffer.
I get "text" one element at a time in a buffer, and I need to concatenate it to a string.
The problem is that I can't seem to figure out how to get the [number] part in the front.
First, is it possible to strcat()
an int
?
I have tried, but can't seem to get it to work.
Second, is it possible to get the '[' ']'
around the variable? (I need the int
value to increase for each loop).
This may be a stupid question, but I really can't figure out how to solve this, and I need the menu to be on this form or something similar.
First of all, try
sprintf
to put your integer into a buffer string. Then, concatenate this string with the one you wanted.Something like this:
Adjust the sizes for your situation.