std::getenv
De cppreference.com
<tbody>
</tbody>
| Dclar dans l'en-tte <cstdlib>
|
||
const char *getenv( const char *env_var ); |
||
Recherche une variable d'environnement avec
env_var nom de l'hte spcifi par la liste environnement et renvoie des informations qui lui sont associs. L'ensemble des variables d'environnement et les mthodes de l'altrer sont dfinis par l'implmentation . 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.
Paramtres
| env_var | - | chane de caractres termine 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
Chane de caractres identifiant la valeur de la variable d'environnement ou NULL si la variable n'est pas trouve .
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;
}
Rsultat possible :
Your PATH is: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Voir aussi
C documentation for getenv
|