Click to See Complete Forum and Search --> : CString Find() error Why ?


Hans Wedemeyer
May 5th, 1999, 11:41 AM
When I call the CString member function "Find" the compiler returns
this error..

error C2661: 'Find' : no overloaded function takes 2 parameters

I used the example from (MSDN Library April 1999)

// Second example demonstrating
// CString::Find( TCHAR ch, int nStart )
CString str("The stars are aligned");
int n = str.Find('e', 5);
ASSERT(n == 12);

Is it only available with VC6 ? MS does not mention anything in the
MSDN Library April 1999.

Is VC5 just out of date ?

regards
Hans Wedemeyer



http://www.flash.net/~hansw/carms.gif
My Web Site
http://www.flash.net/~hansw

Marqy
May 5th, 1999, 12:05 PM
I've used this and it's fine, but I'm developing on VC++6. Do a FindInFiles in your DevStudio include directory and look at the members of CString. I bet they didn't exist in your version...

MJA

Rail Jon Rogut
May 5th, 1999, 12:24 PM
Hi Hans

Prior to VC6, you'll only have:

int Find( TCHAR ch ) const;

int Find( LPCTSTR lpszSub ) const;


You can derive your own class from CString and add the function you need. I wrote my own function to do this:

int SuperFind(int iFrom, const CString *pszValue, char chChar)
{
CString szTemp;
int iTemp;

szTemp = pszValue->Mid(iFrom);

iTemp = szTemp.Find(chChar);

return iTemp;
}

All the best.

Rail

Recording Engineer/Software Developer
Rail Jon Rogut Software
railro@earthlink.net
http://home.earthlink.net/~railro/