Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a new file dialog

Status
Not open for further replies.

TimeOut

Programmer
Nov 21, 2000
16
GB
Hi all!

I'm trying to recreate an existing file (copy old file to a new file). I'm using CFileDialog class to do this. I'm stuck as I get an error.

nameoffile = NewFile.GetFileTitle ();

The line above gives me the error:

error C2440: '=' : cannot convert from 'class CString' to 'char [260]'

Does anyone know what I'm doing wrong. I would be most grateful for any tip, that puts me in the right direction. Thanks, from a beginner.
 
Hi TO,
what I can see from the above Error Discription and the Syntax of GetFileTitle() is that, it returns a CString Object. I guess u have declared nameoffile as char nameoffile[260]. If so, just convert nameoffile declaration to CString nameoffile; and then
nameoffile = NewFile.GetFileTitle ();
should work :).
Regards,
Hemant.



 
I can show you one of a way!


You solve just accomplish like this

nameoffile = (char *)NewFile.GetFileTitle(); or

nameoffile = (char)NewFile.GetFileTitle();

 
Thanks for your tips cibrran and Kapadia. I managed to solve it by declaring the data type to CString nameoffile. Once again thanks for your replies. See you around...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top