Character Pointer

I'm not a complete beginner, but this question is trivial so it seemed appropriate to have it here.

I am working on a roguelike being made with pdcurses and in order to write something to the screen it has to be in this form:

mvprintw (3 + i, MAP_WIDTH + 2, item_index[item_type].item_name );

with the parameters being the x, the y and the text (in char* format). I am wondering how i can have it print the integer "i" before the item name.
You will have to convert the integer to a string (using stringstreams) and then concatenate the other string onto it:
mvprintw(3+i, MAP_WIDTH+2, (StringFromInt(MyInt) + item_index[item_type].item_name).c_str());
Assuming StringFromInt returns a std::string
Last edited on
I received the error "StringFromInt" is undefined; I haven't worked with string/integer conversions so I don't know how to define it/what to define it as or what to #include.
Topic archived. No new replies allowed.