Ostream pointer to the standard output
-
Hello! I'm taking a couple of functions from a windows program and putting them in to my console application (with mfc) but to call one function I need a pointer to the output device. In windows this pointer pointed to a list box, but since consoles don't have those I want to write to the basic output device (like cout does). I've got ostream* Console = NULL; Console = ??? I can't find out how to tell the pointer that it points to the console window. Is this possible? The functions simply get the atached printers and display the text strings. Obseve everything, remember more...
-
Hello! I'm taking a couple of functions from a windows program and putting them in to my console application (with mfc) but to call one function I need a pointer to the output device. In windows this pointer pointed to a list box, but since consoles don't have those I want to write to the basic output device (like cout does). I've got ostream* Console = NULL; Console = ??? I can't find out how to tell the pointer that it points to the console window. Is this possible? The functions simply get the atached printers and display the text strings. Obseve everything, remember more...
Check this, BOOL bFlag = AllocConsole(); HANDLE hnd =GetStdHandle(STD_OUTPUT_HANDLE); DWORD dw = GetLastError(); unsigned long i; WriteConsole(hnd,"test", 4,&i , NULL);