SDL MacOS X (leopard) stdout.txt?

Started by
4 comments, last by Beren77 15 years, 7 months ago
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
Advertisement
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.
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.
@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.
Quote:Original post by Amnesia
@Oluseyi:

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

Yes, I'm staff. No, I wasn't rude. More importantly, I was correct.
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

This topic is closed to new replies.

Advertisement