Sorry I will explain it again.....
This is my code I've written for the function to save the data to a file.Code:#include<ifstream>; using namespace std; CStringList parList; fstream sourcefile; CFileDialog FileDlg(FALSE, _T("txt"),_T("ParameterFile"), OFN_CREATEPROMPT|OFN_HIDEREADONLY | OFN_SHOWHELP|OFN_OVERWRITEPROMPT|OFN_LONGNAMES, _T("Save the file as(*.txt)|*.txt||")); if (FileDlg.DoModal() == IDCANCEL) return; _TCHAR sFileName[MAX_PATH]; BeginWaitCursor(); UpdateData(true); _tcscpy(sFileName, FileDlg.GetFileName()); sourcefile.open(sFileName,ios:out); if(!sourcefile.is_open()) AfxMessageBox(_T("file for saving not opened")); else for (POSITION Pos1 = parList.GetHeadPosition(); Pos1 != NULL); sourcefile<< (LPCTSTR)parList.GetNext(Pos1)+_T('\n'); sourcefile.close();
The CStringList parList contains the datas(Which are enthered by users) from a ListBox(this has done on another function
already). I am trying to load it on the fstream sourcefile.
returns the exact value entered.But it is not loading to the file.Code:parList.GetNext(pos1)
When am opening the file,it has some Hex values there(hope, these r address).
How to fix it???




Reply With Quote
