How do I keep SDL from outputting stdout to a file?
Sorry about the cross-post Oluseyi. It was before I we got your answer. I thought someone in that group might have a good idea.
void ActivateConsole(){ AllocConsole(); HANDLE newConsoleInput = GetStdHandle(STD_INPUT_HANDLE); HANDLE newConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); int inFd = _open_osfhandle((long)newConsoleInput, _O_TEXT); int outFd = _open_osfhandle((long)newConsoleOutput, _O_TEXT); FILE* consoleIn = _fdopen(inFd, "r"); FILE* consoleOut = _fdopen(outFd, "w"); setvbuf(consoleIn, NULL, _IONBF, 0); setvbuf(consoleOut, NULL, _IONBF, 0); *stdin = *consoleIn; *stdout = *consoleOut;}
Here's my console activation function. The only problem is, I still don't get a console [sad]. What I'm probably doing wrong involves HANDLEs probably, since I don't know what a handle is a typedef of. when I use _open_osfhandle(newConsoleInput, _0_TEXT); I get an error: invalid conversion from `void*' to `long int'. I have tried casting it to many things.
Any ideas?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement