Click to See Complete Forum and Search --> : How Do I Get Certain part of a string?


rajc
October 17th, 1999, 01:30 AM
i am trying to get windows text in c++, i need to get the windows text and then extract certain part as my string such as: my name is raj, now here i need the part "raj" how do i do that in vc++?

Serge Gagnon
October 17th, 1999, 01:45 AM
If the text that you want to get is in a CString,
you just have to look in the (Class Member ) of the CString class
and you will find the function that you need or you can try

char buffer[4];

char name[] = "raj name";

int a;

for (a=0; a<3; a++)
{
buffer[a] = name[a];
}

I'm tired and i'm not sure if the best for this is for or while.

Serge Gagnon

kishk91
October 17th, 1999, 02:06 AM
Hi.
CSring as memer 2 functions thatyou can use for this case:
ine if CString::Find and the second is CString::GetAt(int Position);

the first will find some char inside this string.
the second will retrive the current char that place in this position.

HTH
kishk91

kishk91@hotmail.com
http://www.path.co.il
ICQ: 13610258

October 17th, 1999, 02:15 AM
Use CString member functions Mid,Left and Right to extract part of a string.