CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    19

    Converting strings

    i have a program whereby i create a dialog box of CFileDialog type.
    i get the file name (with path) by the CFileDialog:GetPathName funtion.
    i want to send the result to a function having char* as arguement.
    but CFileDialog:GetPathName returns is of type 'class CString (void) const',
    how do i convert?
    fast help appreciated
    Tapan


  2. #2
    Join Date
    May 1999
    Posts
    42

    Re: Converting strings

    CString cPath = dlg.GetPathName();
    LPTSTR pString = cPath.GetBuffer(1);
    someOtherFunc( pString );


    If you modify the string pointed to by pString, you must call ReleaseBuffer() before using other CString member functions on the string (see the CString docs).



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