Using the Console Window With SDL
Moderator: Coders of Rage
Using the Console Window With SDL
So I've been wanting to get a console window working with SDL for quite some time now, and I've gone through a few google searches, but can't really find a concise answer.
So does anyone know how to get it working? Or have a link to an article/tutorial on it?
So does anyone know how to get it working? Or have a link to an article/tutorial on it?
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Using the Console Window With SDL
If by "console window" you mean the terminal that comes up when you sometimes start the app, you can't really use it, primarily due to the fact that stdout and stderr are both redirected to files by SDL. If you mean an in-game console, lazyfoo has a tutorial on text input in SDL: http://www.lazyfoo.net/SDL_tutorials/lesson23/index.phpXianForce wrote:So I've been wanting to get a console window working with SDL for quite some time now, and I've gone through a few google searches, but can't really find a concise answer.
So does anyone know how to get it working? Or have a link to an article/tutorial on it?
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Re: Using the Console Window With SDL
I meant the terminal. And I know it's rerouted, but I thought there was a way to 're'reroute it... hmmmGinto8 wrote:If by "console window" you mean the terminal that comes up when you sometimes start the app, you can't really use it, primarily due to the fact that stdout and stderr are both redirected to files by SDL. If you mean an in-game console, lazyfoo has a tutorial on text input in SDL: http://www.lazyfoo.net/SDL_tutorials/lesson23/index.phpXianForce wrote:So I've been wanting to get a console window working with SDL for quite some time now, and I've gone through a few google searches, but can't really find a concise answer.
So does anyone know how to get it working? Or have a link to an article/tutorial on it?
- combatant936
- Chaos Rift Newbie
- Posts: 39
- Joined: Wed Jul 29, 2009 11:11 pm
- Current Project: It's a secret!!
- Favorite Gaming Platforms: N64, SNES, PS2, PC
- Programming Language of Choice: C++, 65816 asm
- Location: Pennsylvania
- Contact:
Re: Using the Console Window With SDL
If you're using Visual Studio you can set it up to use the console window.
Go to project->properties and under configuration properties go to linker then system.
Where it says "SubSystem", change that to "Console (/SUBSYSTEM:CONSOLE)".
That will make a console window come up along with the SDL window and you can use iostream or whatever you want.
Go to project->properties and under configuration properties go to linker then system.
Where it says "SubSystem", change that to "Console (/SUBSYSTEM:CONSOLE)".
That will make a console window come up along with the SDL window and you can use iostream or whatever you want.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Using the Console Window With SDL
XianForce wrote:I meant the terminal. And I know it's rerouted, but I thought there was a way to 're'reroute it... hmmmGinto8 wrote:If by "console window" you mean the terminal that comes up when you sometimes start the app, you can't really use it, primarily due to the fact that stdout and stderr are both redirected to files by SDL. If you mean an in-game console, lazyfoo has a tutorial on text input in SDL: http://www.lazyfoo.net/SDL_tutorials/lesson23/index.phpXianForce wrote:So I've been wanting to get a console window working with SDL for quite some time now, and I've gone through a few google searches, but can't really find a concise answer.
So does anyone know how to get it working? Or have a link to an article/tutorial on it?
Code: Select all
freopen( "CON", "w", stdout );
freopen( "CON", "w", stderr );
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- davidthefat
- Chaos Rift Maniac
- Posts: 529
- Joined: Mon Nov 10, 2008 3:51 pm
- Current Project: Fully Autonomous Robot
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: California
- Contact:
Re: Using the Console Window With SDL
If you use codeblocks, the debug build always has the console window, the release build does not
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: Using the Console Window With SDL
Both visual studio and xcode still allow virtual terminals for standard output with the correct type of project...
Re: Using the Console Window With SDL
GyroVorbis wrote:Both visual studio and xcode still allow virtual terminals for standard output with the correct type of project...
Wow... Are you kidding me?
I just tried it and it worked.
I tried it like a few months ago and got a BSOD... lol
Well thanks for that then
Re: Using the Console Window With SDL
there's no way your program did that, there's something else going on thereXianForce wrote: I tried it like a few months ago and got a BSOD... lol