-
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
-
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).