|
-
November 9th, 2009, 10:56 AM
#1
Problem on using VC++ 2008
I have worked on VC++6.0,
Now first time, am on VC++.Net 2008 platform....
Here I want to Save some datas of a Listbox to a file... So I have tried the following code
CFileDialog FileDialog(FALSE, "txt","downloader", OFN_CREATEPROMPT|OFN_HIDEREADONLY |
OFN_SHOWHELP|OFN_OVERWRITEPROMPT|OFN_LONGNAMES, "Save the file as (*.txt)|*.txt||");
if (FileDialog.DoModal() == IDCANCEL)
return;
char sFileName[255];
BeginWaitCursor();
UpdateData(true);
strcpy(sFileName, FileDialog.GetFileName());
sourceFile.open(sFileName,ios: ut);
if(!sourceFile.is_open())
AfxMessageBox("file for saving not opened");
else
for (POSITION Pos1 = pFrame->Batch_boardList.GetHeadPosition(); Pos1 != NULL
sourceFile <<pFrame->Batch_boardList.GetNext(Pos1)+'\n';
sourceFile.close();
This was the code I have used in VC++ 6.0,
On the same routine, I've tried it on 2008... But the CFileDialog class itself creates some errors.. n solved.(without error)
Here I can't copy "strcpy(sFileName, FileDialog.GetFileName());"
The error noted as The Parameter 2 cannot convert from CString to char*..
Plz explain how it is so?? and how can I solve it??
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|