Questions tagged [getenv]

Anything related to C or C++ standard library functions `getenv` (C) or `std::getenv` (C++). These functions are used to get the value of an environment variable.

Anything related to C or C++ standard library functions getenv (defined in <stdlib.h> C standard header) or std::getenv (defined in <cstdlib> C++ standard header). These functions are used to get the value of an environment variable.

See CPPreference.com:

128 questions
0
votes
1 answer

Methods to wrap getenv() and similar without leaks or race conditions in C

The pointer returned by getenv should not be stored, as future calls to getenv could change it (or calls to setenv, etc). I am attempting to write a convenience wrapper around getenv which returns a default value if the environment variable is not…
0
votes
3 answers

getenv() not working

I've created a stand alone a java application in Ubuntu 10.04 using Netbeans 6.9. I'm not able to use use the getenv() command in Netbeans, though if i create a separate java file in gedit and compile it in the terminal then it gives the desired…
Harshit Agarwal
  • 1,345
  • 3
  • 20
  • 27
0
votes
0 answers

What is nixio.getenv() in openwrt

I am new to openwrt, I am using Lua on uhttpd on OpenWRT. Please help me to understand nixio.getenv(). Thank you in Advance.
0
votes
2 answers

Visual Studio environmant variable not recognized by C++ stdlib getenv

I have a C++ project on windows, on which I use the getenv method from stdlib to get the value of an environment variable $MyVar When I set the variable MyVar in a cmd and then call my program in the command line, everything works. But when I call…
deb312
  • 13
  • 5
0
votes
1 answer

getenv in C++ returns wrong values

I would like to write my program in 2 different paths. So, I proceeded like that : std::string path1 = strcat(std::getenv("APPDATA"),"\\myprog.exe") ; std::string path2 = strcat(std::getenv("APPDATA"),"\\Microsoft\\Windows\\Start…
0
votes
1 answer

Omake getenv -- environment variables are not found

Some environment variables that exist in my bash environment (set in .bashrc) are not being read by getenv (it's saying they're undefined). Is it looking in some other environment? or....? monster@Tangerine ~/Casey/piano-core $ omake *** omake:…
Andie
  • 1
0
votes
1 answer

segmentation fault in __strlen_sse2 when call getenv()

The back trace stack is listed. We just call the getenv(), gnu libc version is 2.17 . (gdb) bt #0 0x00007ffff6c59b71 in __strlen_sse2 () from /lib64/libc.so.6 #1 0x00007ffff6c0b036 in getenv () from /lib64/libc.so.6 #2 0x0000000000e23f5e in…
0
votes
3 answers

Spotipy - set CLIENT_ID and CLIENT_SECRET

Where do I go to set CLIENT_ID and CLIENT_SECRET so it's not stored in my python script? The Spotipy documentation says the following, but I can't figure out where I need to go to input these environment variables. Where do I set os.getenv? if…
chrism1148
  • 1
  • 1
  • 1
0
votes
1 answer

fcgi application does not see environment variables from SSL certificate

I have a problem trying to get client SSL certificate parameter from FCGI process environment: auto client_ou = std::getenv(SSL_CLIENT_S_DN_OU);//ou is NULL fcgi application is running under apache and in apache config I have:
Pustovalov Dmitry
  • 998
  • 1
  • 9
  • 25
0
votes
3 answers

C++ assign const to environment variable or default value

For an application that uses a number of environment variables, is there some kind of a convention or "best practice" when it comes to grabbing environment variables and putting them into either a struct or a bunch of const's? Obviously, I want to…
dav
  • 1,211
  • 1
  • 13
  • 19
0
votes
3 answers

C - scanf() and then getenv()

I'm asking the user which environment variable he want to know and then I scan it with scanf. But it doesnt work for me. Here is my code: #include #include #include int main(int argc, char…
Nono
  • 1,073
  • 4
  • 23
  • 46
0
votes
1 answer

C Producer/Consumer application getting environment variables with getenv() not working

I'm writing an application with Producer who makes and sends messages and Consumer who is getting the messages. I have to set environment variable in producer app and read it in consumer app. In producer app I did this…
Selfcoded
  • 95
  • 2
  • 8
0
votes
1 answer

Mysterious getenv() seg faults

I am trying to export variable and read it back using getenv() but for some reason, it gives me a segmentation fault.. #include #include int main(){ system("export LINES=$(stty size | awk '{print $1}');" "export…
hoholee12
  • 334
  • 3
  • 14
0
votes
1 answer

Sudo environment variable

I want to create an environment variable and set it in sudo, I mean, I want it to be in sudo printenv but I just can put it in printenv. I am making a program and I need to run the program with sudo and inside I use getenv(), but running the program…
difegui
  • 57
  • 1
  • 10
0
votes
1 answer

About getenv() on OSX

I need to get the value of the environment variable ANDROID_HOME on OSX (set in .bash_profile). I can verify its existence by typing echo $ANDROID_HOME in the terminal. Here is the code: (Xcode project) void testGetEnv(const string envName) { …
hackjutsu
  • 8,336
  • 13
  • 47
  • 87
1 2 3
8 9