Click to See Complete Forum and Search --> : Saving info in editbox control to txt file?


Nathan Strandberg
May 5th, 1999, 09:55 PM
How can I save what the user enters into an editbox to a text file (*.txt). Any suggestions?

Thanks,
Nathan Strandberg

Bob Clarke
May 5th, 1999, 10:26 PM
Example, using MFC:

// assume m_editBox is a CEdit;
// error checking omitted, code not tested
CString cText;
m_editBox.GetWindowText( cText );
CFile txtFile("EditBox.txt", CFile::modeCreate | CFile::modeWrite );
txtFile.Write( cText.GetBuffer(1), cText.GetLength() );
txtFile.Close();