works while running. I'm working in code blocks and I check console application and pause after execution. The problem is when I try to exit, I get what I think is a seg fault, "Process terminated with status -1073741510". I guess this corresponds to a seg fault, according to my google searches. Sometimes it crashes completely. I've tried moving the freopen to before and after SDL_Init() and I've tried including fclose( stdout ) and fclose (stderr) at various places. Am I missing something? Is there a safe way end the program once you override SDL using freopen? I'm not too sure exactly what freopen does, anyway. Thanks.