SDL_Rect to string?

i have created "rect2.x" set it "x = 10" "y = 10"
and im trying to display it in text

to get you the idea what i want:
string text = rect2.x + " " + rect2.y;

but ofc it dosent work. What are the ways to do it?

Im using SDL_ttf to display text:
DrawText(buffer, text, 50, 20, 20, red);
You need to use a stringstream.
Example:
1
2
3
4
5
6
#include <sstream>
...
stringstream ss;
ss << rect2.x << " " << rect2.y;
DrawText(buffer, ss.str(), ...);
...
Thx much.
Topic archived. No new replies allowed.