Hi. I wanted to save an array elements to a text file using Microsoft Visual C++. But I cant seem to put the data into the saved file. I have this part of the code to initiate the save as dialog..Pls help.Thanks

void DATADlg::OnSave()


{



CFile f;


char Filter[]= {"DATA Files(*.skg)|*.skg|Text Files(*.txt)|*.txt|"};


CFileDialog Tmp( FALSE, "skg" ,NULL ,OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT ,Filter);



if( Tmp.DoModal() == IDOK )



{


if( f.Open(Tmp.GetFileName(), CFile::modeCreate | CFile::modeWrite==FALSE))


return;


//'this is where I should put the code to save an array of int say Int DATA[5][5].  :confused:



}
else
return;


f.Close();


}

Recommended Answers

All 2 Replies

Thanks for the reply man,will work on this one and post the results thanks again. :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.