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
2 answers

Moodle Config file using docker env

So I have a docker image for moodle, and it includes a config.php file that can "automate" connection to its database. dbtype = 'pgsql'; $CFG->dblibrary…
Flotolk
  • 313
  • 1
  • 11
  • 37
0
votes
1 answer

Python - How to use os.getenv with Path().resolve()

I have the following code. D_CONFIG_PATH IS ~/winnie/poohbear.toml def get_config_path(): default_path = os.path.expanduser(const.D_CONFIG_PATH) final_path = os.getenv('CONFIG_PATH', default_path) if not final_path.is_file(): …
uncrayon
  • 395
  • 2
  • 11
0
votes
0 answers

os.getenv('DP_MY_WORD_VECTOR') return None

I run the python project in terminal of VS code remote anconda environment.I wrote the DP_MY_WORD_VECTOR variable in a .env file, and want to get the value in code.I used the os.getenv() and it worked well when debugging, but didn't work when run…
0
votes
1 answer

How to get environment variable from FastCGI C++ binary during startup

I have a FastCGI application that loads and processes a lot of data during its startup. And I want it to get some environment variable to determine its input data path, but as much as I understand so far, environment pointer envp comes with the…
Igor Shalyminov
  • 694
  • 2
  • 8
  • 22
0
votes
1 answer

How do I use environment variables (repl.it) to create an array?

If you're not aware of this, environment variables are kind of like secret values in Repl.it as Repl.it makes your code publicly available for everybody. I have a set of keys that I want to remain hidden on the website, and I want the website to…
grf
  • 3
  • 1
0
votes
0 answers

How can I use getenv in PHP?

I have written the following code: test.php $java_path=getenv("JAVA_HOME"); echo 'Java Path : '.$java_path ."
"; when I run through command prompt (Ubuntu terminal) like: >php test.php Output: Java Path : /opt/jdk1.8.0_161 I get the…
Avinash Kadam
  • 93
  • 1
  • 4
0
votes
0 answers

getenv("HOME") returns null in native code for android

I am calling getenv("HOME") from a C++ code which is called from an Android app. for IOS getenv("HOME") returns the corresponding directory but for Android it is null. How can I get the directory where I can read and write files in C++ code for…
0
votes
2 answers

C++ LPTSTR problem calling CreateProcessAsUser with getenv

I am trying to call function CreateProcessAsUser. Passing constant string is fine. Trying to pick up an Environment variable using char* getenv(const char name) is causing me a problem. If I use the following, notepad.exe will…
fred
  • 18
  • 4
0
votes
2 answers

How to change the current directory to a designated directory using chdir() in c?

EDIT The existed directory is not necessarily a sub-directory of the home directory. It can be a sub-directory of a sub-directory of the home directory. End of EDIT I am reading a user input (e.g., cd existedDirectory) to change the current…
gsk
  • 107
  • 11
0
votes
1 answer

Why does strcat to getenv() changes subsequent getenv() calls?

I use getenv() in my c code. Here is the code I use #include #include int main() { char *path=getenv("USERPROFILE"); strcat(path,"\\bullshit"); char *newpath=getenv("USERPROFILE"); printf("%s",newpath); } The…
yeah_well
  • 130
  • 1
  • 6
0
votes
3 answers

Symfony 4 - Use environment variable in dev and test

as part of a training on Stripe on Symfony, I am trying to set up an environment variable for testing. So I have to set a variable to false for testing. And for other environments, the variable must be true. So, I did this…
eronn
  • 1,690
  • 3
  • 21
  • 53
0
votes
1 answer

How can I acces files with getenv() in c++ with using pipe in a bash?

I want to implement a function for MapReduce framework so my task is to create a mapper that concatenate text files. Here is my bash script; for i in text1.txt text2.txt text3.txt do cat $i | ./myfunction done And myfunction()…
0
votes
1 answer

why is getenv MT-safe in man page?

In POSIX.1-2017: The getenv() function need not be thread-safe. But, in man page, the genenv is MT-Safe env. │Interface │ Attribute │ Value │ │getenv(), secure_getenv() │ Thread safety │ MT-Safe env │ However, The …
xiao xiao
  • 21
  • 2
0
votes
0 answers

PHP GetEnV Returns same username on same network

I have tried to run getenv username code shown below and it shows correct username on my PC but when I access the same from other PC on same network by my ip he also gets my username. His username on his PC should be shown when he access my PC…
Iqra Khan
  • 3
  • 5
0
votes
2 answers

getenv("APPDATA") returns incorrect values if current user having username containing unicode characters

Windows gives an api to get environment variable values using getenv(). If current user is having username containing localised characters (i.e. multibyte characters), then getenv returns incorrect value. current user with username: テスト…
user7234
  • 11
  • 3
1 2 3
8 9