[SOLVED]Using windows' environmental variables in the Qt code
-
wrote on 17 Jun 2014, 12:34 last edited by
Hi.
I have a piece of code that needs to be able to access my environmental variables to create a path. I know how to make it work in the .pro file (INCLUDEPATH += "$$(NTTOOLS)/libcurl/trunk/include/curl" where NTTOOLS is the name of my variable) but I cannot seem to get it so I can access that variable in the actual c++ code.
I have tried creating a variable in the .pro file that is equal to NTTOOLS and then using that in the code, but it's not working.
Is there a way to view environmental variables in the code? if not, how do I access variables created in the pro file? I have looked online for this but haven't found much.
Thanks in advance!
-
wrote on 17 Jun 2014, 14:39 last edited by
For runtime access to the environment variable take a look on "qgetenv()":http://qt-project.org/doc/qt-5/qtglobal.html#qgetenv
-
wrote on 17 Jun 2014, 14:44 last edited by
Perfect! Thank you, I knew there had to be an easy way to do it.
1/3