bool LogError(const std::string& message, bool close = true)
{
  std::ofstream f(L"Scheduler-errors.log", std::ios::app);
  if (! f)
  {
    std::wstring wmessage = NarrowToWide(message);
    MessageBox(NULL, wmessage.c_str(), L"ERROR", MB_OK);
    if (close)
    {
      PostMessage(hAppWnd, WM_CLOSE, 0, 0);
    }
    return close;
  }
  f << message << std::endl;
  f.close();

  if (close)
  {
    PostMessage(hAppWnd, WM_CLOSE, 0, 0);
  }

  return close;
}
Ejemplo n.º 2
0
inline std::string NarrowToUtf8(const char* narrow_sz)
{
	return WideToUtf8(NarrowToWide(narrow_sz));
}