I am writing an experimental networking program, basically a test program for learning networking. I am using SDL and SDL_net in Code::Blocks with mingw, so the console output was being directed to stdout.txt. I searched around and found that you can fix this by including after SDL_Init():
freopen("CON", "w", stdout); //stops redirect of output
freopen("CON", "w", stderr); //and errors...
This worked perfectly, but only when building and running the program in the IDE: when run outside of the IDE ( e.g. double clicking on the program) the program runs properly, with the exception of the console output, which is still blank. As the program is supposed to be a console program this is a severe problem... I don't want to have to always run the program in the IDE to use it.
Any solution is apreciated but I would prefer that it was an alteration to the code, although in a pinch a batch file will do (I've read a couple of posts where this is the only thing that works, but they didn't go into much detail, so I can't replicate it). Thanks.