environmental variables?
-
whats the best way to get environmental variables like %windir% %userprofile% and so on? i've tried the above but vc++ 6.0 dont recognize them when for instance doing something like this: CString MyVar; MyVar = "%windir"; MessageBox(MyVar,"titletext"); ..returns "%windir%" in the messagebox not "C:" there may be a simple solution but i cant find it. anyone? thanx!
-
whats the best way to get environmental variables like %windir% %userprofile% and so on? i've tried the above but vc++ 6.0 dont recognize them when for instance doing something like this: CString MyVar; MyVar = "%windir"; MessageBox(MyVar,"titletext"); ..returns "%windir%" in the messagebox not "C:" there may be a simple solution but i cant find it. anyone? thanx!
hobbyprogrammer wrote:
whats the best way to get environmental variables like %windir% %userprofile% and so on?
Try GetEnvironmentVariable (VC++) or getenv (C++)
-
whats the best way to get environmental variables like %windir% %userprofile% and so on? i've tried the above but vc++ 6.0 dont recognize them when for instance doing something like this: CString MyVar; MyVar = "%windir"; MessageBox(MyVar,"titletext"); ..returns "%windir%" in the messagebox not "C:" there may be a simple solution but i cant find it. anyone? thanx!
You need to convert the %***% to a real path before you can use it as a path. Try ExpandEnvironmentStrings()