
By: Console | Date: Oct 25 2009 14:33 | Format: C++ | Expires: never | Size: 563 B | Hits: 912
- #include <windows.h>
- #include <cstdlib>
- #include <iostream>
- #include <conio.h>
- #include <stdio.h>
- #include <io.h> /* _open_osfhandle */
- #include <fcntl.h> /* for _O_TEXT and _O_BINARY */
- void Console()
- {
- int hCrtIn, hCrtOut;
- FILE *conIn, *conOut;
- AllocConsole();
- hCrtIn = _open_osfhandle ((intptr_t) GetStdHandle(STD_INPUT_HANDLE), _O_TEXT);
- hCrtOut = _open_osfhandle ((intptr_t) GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
- conIn = _fdopen( hCrtIn, "r" );
- conOut = _fdopen( hCrtOut, "w" );
- *stdin = *conIn;
- *stdout = *conOut;
- }
Latest pastes
2 hours ago
2 hours ago
2 hours ago
3 hours ago
6 hours ago