title: how to append log details in log file in MFC (VC++)?
body: <p>i have created one method to write to Log file but each time it overrite the log details , i want to create a new entry everytime for logging details.My log method is as below :</p>
  
  <pre><code>void CNDSConnectDlg::WriteLogData()
  {
  
  
      CString strUserName = "";
      m_editUserName.GetWindowText(strUserName);
      FILE * pFile = NULL;        
      int iErr = 0;
      iErr = fopen_s(&amp;pFile,"NDSLog.txt","w");
  
      if (iErr == 0)
      {
  
      CString strConnectionStatus = "";
      CString strServerAddress = "";
      CString strDateTime = "";
      SYSTEMTIME systime;
      GetLocalTime(&amp;systime); 
  
  
      if(m_bConnectionStaus == true)
      {
         strConnectionStatus = "Success";
      }
      else
      {
         strConnectionStatus = "Failure";
      }
  
      strUserName.Format("%s",strUserName);
      strConnectionStatus.Format("%s",strConnectionStatus); 
      strServerAddress.Format("%s",m_strIPAddress);
      strDateTime.Format("%i:%i:%i\\%02i-%02i-%02i",
              systime.wHour,
              systime.wMinute,
              systime.wSecond,
              systime.wYear,
              systime.wMonth,
              systime.wDay);
  
      fputs("UserName = " + strUserName + " connected to "
            "ServerAddress = " +strServerAddress + " at "
            "Date/Time = " + strDateTime + " "  
            "ConnectionStatus = " +strConnectionStatus + " ",pFile); 
  
  
      fclose (pFile); 
      }
      else
      {
           MessageBox("Error in writing to Log","NDS",MB_ICONERROR | MB_OK);
  
      }
  </code></pre>
  
  <p>}</p>
  
  <p>Any help is highly appreciated .
  Thanks in Advance.</p>