Archived

This topic is now archived and is closed to further replies.

Dwiel

sprintf for strings

Recommended Posts

I was wondering how to use the sprintf type of function layout for a string... not a CString an std::string. there is an sprintf, but you need to have a buffer and so also must know a maximum size... Id really rather not need to know the max because im displaying a tree and because of its recursive nature it would be hell doing it this way.. is there a simple way i can some how do this:
  

//rather do it this way:


std::string str;
str = ***printf("x: %i\ny: %i\nz: %i\n", x, y, z);

//doing it this way:


std::string str;
str = "x: ";
str += x;
str += "\ny: ";
str += y;
str += "\nz: ";
str += z;
str += "\n";

  
the second way.. the current method is such a pain.. so i am looking for an alternative... thanx for the help ahead of time!!! dwiel ~ tazzel3d

Share this post


Link to post
Share on other sites