; GetEnv Example ; -------------- ; GetEnv reads a variable out of this program's environment block. ; Windows sets these three for every process, so they always exist. Print "USERNAME = "+GetEnv$("USERNAME") Print "OS = "+GetEnv$("OS") Print "CPU count = "+GetEnv$("NUMBER_OF_PROCESSORS") Print "" ; A variable that is not set comes back as an empty string rather ; than an error, so Len() is the way to test for "not there" missing$=GetEnv$("BLITZ3D_NO_SUCH_VARIABLE") Print "Unset variable returned "+Len(missing)+" characters" Print "" ; SetEnv writes one and GetEnv reads it straight back - handy for ; passing a level name or difficulty on to a program you ExecFile SetEnv "BLITZ3D_DEMO_LEVEL","forest_ruins" Print "After SetEnv: "+GetEnv$("BLITZ3D_DEMO_LEVEL") ; Tidy up - an empty value removes the variable again SetEnv "BLITZ3D_DEMO_LEVEL","" Print "After clearing: ["+GetEnv$("BLITZ3D_DEMO_LEVEL")+"]" Print "" Print "Press any key to close the example" WaitKey End