Problem with stdout.txt in SDL 1.2.14

So the latest version 1.2.14 by default creates stdout.txt if the SDL_STDIO_REDIRECT is not set.
This works fine in some folders, but not when the app is installed in Program Files, where the rights are restricted.
So it cannot create this file, and when it tries to write into it, it just crashes.
This is the problem. Setting SDL_STDIO_REDIRECT from inside the app is not possible (and why do I even care?). IMHO, SDL should not redirect stdio by default.
I will stick with 1.2.13.

You are correct that you can’t set it from inside the app. I don’t think you can set it when compiling your app either. You have to reconfigure and recompile SDL for that.

If I’m not mistaken, the reason this was done by default was so that, on Windows, it wouldn’t pop up a console. Or, I guess if it was compiled as a GUI application, the stdout might as well be > /dev/null. That’s all well and good unless you are debugging.

I haven’t done a lot of programming and testing on Vista or 7, so I haven’t had this problem yet. Seems to me the program should have access to read and write in it’s folder. However, I was playing a game that refused to save my progress because it needed to create a save folder which it didn’t have permission to do. I had to create it manually. That was on 7.

You might look into using an installer and having it modify the permissions so the program can create and modify in it’s folder.

And remember, as long as you are dynamically linking SDL, your end user has the right and the ability to swap for the latest SDL. So while you provide 1.2.13, they may upgrade it to 1.2.14.

MakKlaski wrote:> So the latest version 1.2.14 by default creates stdout.txt if the SDL_STDIO_REDIRECT is not set.

This works fine in some folders, but not when the app is installed in Program Files, where the rights are restricted.
So it cannot create this file, and when it tries to write into it, it just crashes.
This is the problem. Setting SDL_STDIO_REDIRECT from inside the app is not possible (and why do I even care?). IMHO, SDL should not redirect stdio by default.
I will stick with 1.2.13.

Well, I haven’t had any problems with console on Windows XP/Vista and Linux. It doesn’t pop up.
There are special folders for writing data on Windows Vista and 7. App folder in Program Files is read-only for any non-elevated app as far as I know.

Hello !

Well, I haven’t had any problems with console on Windows XP/Vista and Linux. It doesn’t pop up.
There are special folders for writing data on Windows Vista and 7. App folder in Program Files is read-only for any non-elevated app as far as I know.

I don’t know if there is a way to change the folder where SDL
is writing the stdout.txt and stderr.txt without recompiling SDL,
but the best thing to do would be to open both files in the SYSTEM TEMP directory on Windows.

The easiest way to get the PATH of this directory, is using the content of the TEMP/TMP variables.

CU