logfile.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /******************************************************************************
  2. |* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  3. |* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4. |* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5. |* PARTICULAR PURPOSE.
  6. |*
  7. |* Copyright 1995-2005 Nero AG. All Rights Reserved.
  8. |*-----------------------------------------------------------------------------
  9. |* NeroSDK / AudioPluginManager
  10. |*
  11. |* FILE: logfile.cpp
  12. |*
  13. |* PURPOSE: CLogFile implementation for debugging purposes
  14. ******************************************************************************/
  15. #include "stdafx.h"
  16. #include "LogFile.h"
  17. #ifndef WIN64
  18. void CLogFile::SetFileName(const char *szFilePath)
  19. {
  20. m_csFilePath = szFilePath;
  21. }
  22. void CLogFile::operator<<(const char *szString)
  23. {
  24. // We need to open the file, write something and close it immediately
  25. // because nobody know what will happen after this function.
  26. CStdioFile file;
  27. // Can we open the existing file?
  28. if(!file.Open(m_csFilePath, CFile::modeWrite) &&
  29. // We couldn't open it, can we create it?
  30. !file.Open(m_csFilePath, CFile::modeWrite|CFile::modeCreate))
  31. return;
  32. // We should move to the end of the file.
  33. file.Seek(0, CFile::end);
  34. // file.WriteString(">>>\n");
  35. file.WriteString(szString);
  36. file.WriteString("\n");
  37. file.Flush();
  38. file.Close();
  39. }
  40. #endif // WIN64