std::getenv
De cppreference.com
<tbody>
</tbody>
| Déclaré dans l'en-tête <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.
You can help to correct and verify the translation. Click here for instructions.
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. |
Retourne la valeur
Chaîne de caractères identifiant la valeur de la variable d'environnement ou NULL si la variable n'est pas trouvée .
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.
You can help to correct and verify the translation. Click here for instructions.
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
Voir aussi
C documentation for getenv
|