Link to home
Start Free TrialLog in
Avatar of yyzz
yyzz

asked on

int to string

I want to know how to convert an integer to string.
such as 123456 to "123456".
ASKER CERTIFIED SOLUTION
Avatar of guruprasad031298
guruprasad031298

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rayb
rayb

The conversion functions that guruprasad points out do work well.  Here's an alternative:

{
  char buffer[64];
  sprintf( buffer, "%ld", 123456 );
}

If using MFC, you could also use the CString::Format method.

Avatar of yyzz

ASKER

How to do it with c++? Does stdlib.h include it?
yeah. you need to include <stdlib.h> in your source code to do that.
Avatar of yyzz

ASKER

thanks.