CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1

    CString Find() error Why ?

    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




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

  2. #2
    Join Date
    May 1999
    Location
    UK
    Posts
    59

    Re: CString Find() error Why ?

    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

  3. #3
    Join Date
    May 1999
    Location
    CA, USA
    Posts
    586

    Re: CString Find() error Why ?

    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
    [email protected]
    http://home.earthlink.net/~railro/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured