Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Int to String

Status
Not open for further replies.

BobLoblaws

Programmer
Nov 20, 2001
149
0
0
CA
I have integer with the value 5.
I need to store the value in a string.

If I use this, strValue = intValue
strValue becomes the club symbol, which is #5 in the ascii chart. I want the number 5. I also need it to work in the thousand range.
 
you can use one of this codes:

#include<stdio.h>
.....
...
sprintf( buffer,&quot;%d&quot;,inValue );

or

#include<stdlib.h>
.....
...
char buffer[15];
int inValue;
_itoa( inValue, buffer, 10 );

 
#include<stdio.h>

string buffer;
int inValue;
sprintf( buffer,&quot;%d&quot;,inValue );

This gives me a cannot convert from string to char*.
Any other ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top