See all environment VARS

Blitz3D Forums/Blitz3D Programming/See all environment VARS

virtlands(Posted 2013) [#1]
; Hi, this Blitz3D program demonstrates a quick and easy
; method to display ALL environment variable strings,
;
; -- THIS CODE HAS BEEN UPDATED, SCROLL DOWN BELOW to see Version 2
;
;


Yue(Posted 2013) [#2]
nice!! :)


virtlands(Posted 2013) [#3]
; Glad you like it Yue.

;
; I had some free time, and came up with an idea that may be a small improvement for this program.

; Click here to download the updated code,
http://uploadingit.com/file/ss7vvemoyfihuvki/envvars_V2.zip

; (The link includes updated PureBasic code, B3D code, as well as the DLL.)

; Blitz3D function version 1 is SeeEnvVar()
; Blitz3D function version 2 is SeeEnvVarT()

; As you know, any function can only return one string at a time, and
; therefore in function version 1 of the environment variables thing
; I had to combine two strings together in the form "NAME=VALUE" in order to return a value.

; The "Name=Value" format may be kind of annoying for usage because
; then the user has to dissect it apart again back into its components, ...

; Therefore I came up with the idea in Version 2 of letting the function
; "pulse" out data, (it spits out data one part at a time per each function time).
;
; I know this is a weird idea, but it works.

The Function usage is really simple, like this:

{ e1 and e2 are special string constants that allow detection of "end of list", or "error". }

The first call to the function returns an env "Name",
then calling the function again returns the env "Value".

The DLL code keeps track of the function's internal state with special Global vars.

[shown here is a portion of the PureBasic DLL code]


; ----------------------------------------------------------

Obviously, there is the potential to return a structure TYPE that
contains 2 strings in it, ... but it's kind of complicated to do that
with a DLL, don't you think?

{ This B3D code is already included in the above download link. }


;; I was thinking that "pulsed" functions can have lots of possibilities,
;; and beyond the "environment vars" sample.