PageRenderTime 28ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/mordor/streams/std.cpp

http://github.com/mozy/mordor
C++ | 23 lines | 17 code | 5 blank | 1 comment | 4 complexity | 761977d338d2dc98256d033e44f77fa6 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. // Copyright (c) 2009 - Mozy, Inc.
  2. #include "std.h"
  3. #include "mordor/exception.h"
  4. namespace Mordor {
  5. StdStream::StdStream(IOManager *ioManager, Scheduler *scheduler, int stream)
  6. {
  7. #ifdef WINDOWS
  8. HANDLE hFile = GetStdHandle(stream);
  9. if (hFile == INVALID_HANDLE_VALUE)
  10. MORDOR_THROW_EXCEPTION_FROM_LAST_ERROR_API("GetStdHandle");
  11. if (hFile == NULL)
  12. MORDOR_THROW_EXCEPTION_FROM_ERROR_API(ERROR_FILE_NOT_FOUND, "GetStdHandle");
  13. init(hFile, ioManager, scheduler, false);
  14. #else
  15. init(stream, ioManager, scheduler, stream);
  16. #endif
  17. }
  18. }