How do I set environmental variables?

Hi,

I noticed some SDL E-mails about an environmental variable:
“SDL_VIDEO_CENTERED”

How exactly do I set the above variable to true?

Said something about
"SDL_putenv"
but I do not see this in the documentation.

If someone could just write the line of code to do this then that would be
fine.

Thanks in advance!

My SDL PC Windows game project:
http://www.silentheroproductions.com/tetribattle3_100percentforpcwindows.htm

(http://www.silentheroproductions.com/tetribattle3_100percentforpcwindows.htm)

Jesse
SLNTHERO at AOL.com (mailto:SLNTHERO at AOL.com)

read man putenv and man setenv if you want to do it from C or C++
-mike
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060523/2a40438b/attachment.pgpOn Monday 22 May 2006 17:09, SlntHero at aol.com wrote:

How exactly do I set the above variable to true?

SlntHero at aol.com wrote:

Hi,

I noticed some SDL E-mails about an environmental variable:
“SDL_VIDEO_CENTERED”

How exactly do I set the above variable to true?

Said something about
"SDL_putenv"
but I do not see this in the documentation.

If someone could just write the line of code to do this then that would
be fine.

Thanks in advance!

My SDL PC Windows game project:
http://www.silentheroproductions.com/tetribattle3_100percentforpcwindows.htm

Jesse
SLNTHERO at AOL.com <mailto:SLNTHERO at AOL.com>



SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

just do the following:

#include “SDL_stdinc.h”

SDL_putenv(“SDL_VIDEO_CENTERED=center”);

if you want the window centered, or

SDL_putenv(“SDL_VIDEO_WINDOW_POS=10,10”);

if you want the window place it at a certain x,y position.

you may check if you succeeded putting the envvars ( it can fail if your
sdl-library is not compiled in exactly the same mode as your application):

char * temp=SDL_getenv(“SDL_VIDEO_WINDOW_POS”);
if(temp)
cout << “\nSDL_VIDEO_WINDOW_POS:” << temp;

temp=SDL_getenv(“SDL_VIDEO_CENTERED”);
if(temp)
cout << “\nSDL_VIDEO_CENTERED:” << temp;

but be warned: it seems like using these environment variables is a
feature that is going to be deprecated! i do not like setting envvars
too, i would much more like to see some api - enhancements to control
the placement of a windowed sdl surface.

Hello Mike,

Tuesday, May 23, 2006, 6:52:10 AM, you wrote:

MF> read man putenv and man setenv if you want to do it from C or C++
MF> -mike

Windows doesn’t have man pages :)–
Best regards,
Peter mailto:@Peter_Mulholland

Yes, but you can use your compiler documents.

2006/5/23, Peter Mulholland :> Hello Mike,

Tuesday, May 23, 2006, 6:52:10 AM, you wrote:

MF> read man putenv and man setenv if you want to do it from C or C++
MF> -mike

Windows doesn’t have man pages :slight_smile:


Best regards,
Peter mailto:darkmatter at freeuk.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

SlntHero at aol.com SlntHero at aol.com wrote on Mon May 22 14:09:04 PDT
2006:

something about “SDL_putenv” but I do not see this in the documentation.

This sets the SDL window to top-left (in C):
putenv(“SDL_VIDEO_WINDOW_POS=0,0”);

See http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fenvvars