Does anyone know any reason why using cout << "string"; would be sending "string" the stdout.txt instead of the actual console windows?
If specific program details are needed let me know, but I figure this error is generic enough where maybe I'm just being stupid about something. It is 2:00 AM..
cout going to stdout.txt
Moderator: Coders of Rage
- 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:
cout going to stdout.txt
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- cypher1554R
- Chaos Rift Demigod
- Posts: 1124
- Joined: Sun Jun 22, 2008 5:06 pm
Re: cout going to stdout.txt
well, did you do this:
instead of this:
..?
Code: Select all
std::ofstream cout("stdout.txt");
cout << "string";
Code: Select all
std::cout << "string";
- PixelP
- Chaos Rift Regular
- Posts: 153
- Joined: Tue Oct 07, 2008 12:23 pm
- Programming Language of Choice: c/c++
- Location: sweden
- Contact:
Re: cout going to stdout.txt
if youre coding something in sdl you cant do that, you cant use the console in a sdl program, all the output goes to stdout.txt.
it works in allegro thou.
it works in allegro thou.
- 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: cout going to stdout.txt
But the weird part about it is a console window pops up with a blinking cursor, just the cout text doesn't display. I can still type in the filename and hit enter, then type q and hit enter and the program exits with status 3. Yet my debug output file (not stdout) tells me that the program received the file name and q command fine.PixelP wrote:if youre coding something in sdl you cant do that, you cant use the console in a sdl program, all the output goes to stdout.txt.
it works in allegro thou.
EDIT: I got it to work! Although it took a good bit of googling. Simply add the following line of code after SDL_Init():
Code: Select all
freopen( "CON", "w", stdout );
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: cout going to stdout.txt
Interesting, my console worked in my SDL app without any special code.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.