Espaces de noms
Variantes
Affichages
Actions

std::getenv

De cppreference.com
< cpp‎ | utility‎ | program
 
 
 
Services d'appui aux programmes
La fin du programme
Original:
Program termination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
abort
exit
quick_exit (C++11)
_Exit (C++11)
Communiquer avec l'environnement
Original:
Communicating with the environment
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
getenv
Signaux
Original:
Signals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Types de signaux
Original:
Signal types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
SIGABRT
SIGFPE
SIGILL
SIGINT
SIGSEGV
SIGTERM
Non-locales sauts
Original:
Non-local jumps
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
setjmp
longjmp
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
jmp_buf
 
Defined in header <cstdlib>
const char *getenv( const char *env_var );
Recherche une variable d'environnement avec env_var nom de l'hôte spécifié par la liste environnement et renvoie des informations qui lui sont associés. L'ensemble des variables d'environnement et les méthodes de l'altérer sont définis par l'implémentation .
Original:
Searches for an environmental variable with name env_var in the host-specified environment list and returns information associated with it. The set of environmental variables and methods of altering it are implementation-defined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Sommaire

[modifier] Paramètres

env_var -
chaîne de caractères terminée par NULL identifier le nom de la variable d'environnement qu'il faut chercher
Original:
null-terminated character string identifying the name of the environmental variable to look for
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Retourne la valeur

Chaîne de caractères identifiant la valeur de la variable d'environnement ou NULL si la variable ne soit pas trouvé .
Original:
Character string identifying the value of the environmental variable or NULL if such variable is not found.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Exemple

#include <iostream>
#include <cstdlib>
 
int main(int argc, char *argv[])
{
    std::cout << "Your PATH is: " << std::getenv("PATH") << std::endl;
}

Résultat possible :

Your PATH is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

[modifier] Voir aussi

C documentation for getenv