Sign in to follow this  

SDL MacOS X (leopard) stdout.txt?

This topic is 3369 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

Hi, I am new to Mac programming and I have used Visual Studio on Windows before, so please forgive me if the following question is completely stupid, but I couldn't find anything on google: I am looking for the flag in SDL 1.2.13 that turns on output redirecting on MacOS X. It seems to me that such a flag does not exist (at least not in SDLmain.m), but how do I get my "stdout.txt" and "stderr.txt" in MacOS X? Or, if I can't get them: Where does the output of my game go? Thanks in advance! Philipp

Share this post


Link to post
Share on other sites
I don't know anything about Mac but since it is based on BSD I will give it a shot.

When you run a program, are you running it from the command line or clicking on it?
In Linux if I was to click on an application from the GUI it doesn't show the command line, where this text is being displayed. Try running from the command line and you should see the outputted text.

You should also be able to redirect this text info into any files that you desire:
$ progname >stdout.txt 2>stderr.txt

I'm not sure if Mac support the "2>" standard error redirection.

Share this post


Link to post
Share on other sites
Quote:
Original post by Amnesia
I don't know anything about Mac...

Worse, you don't know anything about SDL.

In SDL, the standard output stream (stdout) may be redirected to a file named stdout.txt. Beren77 is asking how to enable that under Mac OS X Leopard, not how to redirect file streams at the terminal.

(For the record, Mac OS X does support stream redirection at the console.)

@Beren7:
The IO redirection feature was only built for Windows, AFAIK. You'll need to edit SDL_main.c - the code you want is inside of WinMain, beginning with #ifndef KEEP_STD_STDIO... - and then rebuild by linking against it rather than SDLmain.lib.

Share this post


Link to post
Share on other sites
@Oluseyi:

Wow aren't you rude. And you're part of the staff?

Since I'm coming from Linux I wasn't aware of this "IO redirection feature [that] was only built for Windows". From my point of view it appeared likely that Linux and Mac would be related.

Also, if you are correct and it is only a Windows feature then my answer still stand as a possibly valid solution.

Share this post


Link to post
Share on other sites
Hey guys, thanks for your replies.

I figured by now that indeed, the output of my program is printed on the console (i.e. I don't need the redirect feature and I'll have to run my program from the console -- so, you were both right ;)).

As for WinMain: I knew about the preprocessor flag, but couldn't find it on Mac -- that's why I asked. Turns out I don't need it, because all output is indeed printed on the console and I could redirect it to anywhere I like.

Thanks again.
Beren

Share this post


Link to post
Share on other sites

This topic is 3369 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this