Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


using iostream.h before SDL

This topic is 5918 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making an SDL program and I want to recieve some information before it starts in an MSDOS window (using cin). It doesn''t seem to go to the DOS window, it just starts the SDL window...here''s the code. int main(int argc, char *argv[]) { cout << "Enter Player1''s name:\n"; cin >> Player1.name; Uint8* keys; //SDL starts here... The program skips past the cout and cin commands... ------------------ Stupid Morons- my current projects

Share this post

Link to post
Share on other sites
Do NOT use <iostream.h>, it is a deprecated header.

Use <iostream> instead, even if it require you to type using namespace std; at the beginning of your source files and to qualify all class names with std:: in your header files.

Now, to answer your question, SDL redirects cin, cout and cerr to files when it starts ("stdout.txt" and "stderr.txt" IIRC, you may have to provide "stdin.txt" yourself or pipe it into your app). There may be options to disable that. Read the SDL source code to find out (yes, it's available!), if it is not documented.

[Questions (STFW) | GDNet Start Here | GDNet Search | Forum FAQ | Google | Asking Smart Questions ]
[Docs (RTFM) | MSDN | SGI's STL | OpenGL | File formats]
[C++ Must Haves (RTFS) | MinGW | Boost | Loki | FLTK | SDL ]

Stolen from Magmai Kai Holmlor, who held it from Oluseyi, who was inspired by Kylotan...

[edited by - Fruny on May 6, 2002 5:32:50 PM]

[edited by - Fruny on May 6, 2002 5:40:45 PM]

Share this post

Link to post
Share on other sites
As far as I know, that redirection is present only under Windows. Linux seems fine with redirecting output to the console, but not windows.

You may also want to concider SDL_Console present on the libraries page on libsdl.org. It''s not as clean as cout, but you can avoid file outputing entirely then.



"...I was given three choices, the earth, the stars, or..."

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!