MFC, log to file


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. CFile file;
  2.  
  3. // Open file using 3 flags.
  4. file.Open( pFilename, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite );
  5.  
  6. file.SeekToEnd(); // Seek to append. Otherwise, it'll write the beginning.
  7.  
  8. file.Write(s, s.GetLength() ); // write some CString s.
  9.  
  10. file.Close();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.