MCPcopy Create free account
hub / github.com/bwapi/bwapi / openConsole

Function openConsole

bwapi/BWAPI/Source/BWAPI/Console.cpp:48–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46#endif
47
48 bool openConsole(bool attach, bool alloc)
49 {
50 if ((attach && AttachConsole(ATTACH_PARENT_PROCESS)) || (alloc && AllocConsole()))
51 {
52 *stdin = *_tfdopen(_open_osfhandle(reinterpret_cast<intptr_t>(::GetStdHandle(STD_INPUT_HANDLE)), _O_RDONLY), _T("r"));
53 *stdout = *_tfdopen(_open_osfhandle(reinterpret_cast<intptr_t>(::GetStdHandle(STD_OUTPUT_HANDLE)), _O_WRONLY), _T("a"));
54 *stderr = *_tfdopen(_open_osfhandle(reinterpret_cast<intptr_t>(::GetStdHandle(STD_ERROR_HANDLE)), _O_WRONLY), _T("a"));
55
56 //make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog point to console as well
57 std::ios::sync_with_stdio(true);
58 return true;
59 }
60 return false;
61 }
62
63 void autoOpenConsole(bool attach, bool alloc)
64 {

Callers 3

CheckAttachConsoleFunction · 0.85
writeMethod · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected