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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CString or string

Status
Not open for further replies.

jayjay60

Programmer
Jun 19, 2001
97
FR
I would like to concatenate 2 variables like that "1" and "y", but i don't know how to declare all my variables, as string, CString or lpcstr?

thanks for your answers

jayjay
 
If U use CString, U can just + them, if U'll use lptstr (LPTSTR a=new char[2],...) U can strcat them or sprintf them into other string.
 
is up to you.
for lpscstr you will:
LPCSTR x=new char[100];
int y=1;
spritf(x,"%dy",y);
but for CString is
CString x;
x=1;
x+='y'; John Fill
1c.bmp


ivfmd@mail.md
 
You could also use CString as follows:

CString my_string;
my_string.Format("%dy",value);

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top