
Qbasic/Quickbasic & setting environment variables
Regarding: Re: Qbasic/Quickbasic & setting environment variables
Quote:
>: all I want to do is SET STRING=HELLO, etc. ... easy to do in DOS, but not
>: within my programs
>Well, first the statement is ENVRON, not ENVRON$. ENVRON$ *gets* environment
>variables.
>Try this:
>DIM myVar AS STRING
Why?
Quote:
>myVar$ = "QBis = better than BASICA"
>ENVIRON myVar$
>If that doesn't work, then I would assume that you've run out of environment
>space in DOS, or you've been trying to use ENVIRON$.
I've seen that happen even when I have plenty of environment space
available - eventually, I stopped even trying to use it. Also, the original
poster should note that any environment variable set by a QB program - if you
can actually manage to set one - will be CLEARED when the program exits!
Apparently, they use local *copies* of the environment, and when the program
exits, that copy of the environment is also shut down.
IMHO, the ENVIRON keyword is a good idea that just doesn't work. I've
tried it in QB45 *and* PDS, and it doesn't work in either one. I gave up on it
years ago. [Footnote: I just tried your example code in PDS, and that didn't
work either.]