Help with int to char c++

  • johnsson
  • Born
  • Born
  • johnsson
  • Posts: 1

Post 3+ Months Ago

Im trying to print out cursor position on a window. I get the point coords ok but cant print them. TextOut doesnt accept integers. Is there another function similar to TextOut which prints also numbers or is there a simple way to convert int to char?
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

Code: [ Select ]
sprintf(myString, "X: %d", intValue);

then use the TextOut() function to print "myString"
  • dr_geek
  • Beginner
  • Beginner
  • User avatar
  • Posts: 62
  • Loc: london town

Post 3+ Months Ago

better yet, use the c++ standard libs:

#include <string>
#include <sstream>
using namespace std;

int main(int argc, char* argv[])
stringstream ss;
ss << 69;

string goo = ss.str();

// goo now holds the string "69" and can easily
// be converted to a char * and will clean itself
// up when it goes out of scope

return 0;

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 24 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.