名前空間
変種
操作

std::getenv

提供: cppreference.com
< cpp‎ | utility‎ | program

 
 
ユーティリティライブラリ
支援を入力します (basic types, RTTI, type traits)
動的なメモリ管理
エラー処理
プログラムユーティリティ
可変個引数関数
日付と時刻
関数オブジェクト
initializer_list(C++11)
bitset
hash(C++11)
関係演算子
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
ペアとタプル
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
フォワード、スワップ、および移動
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
プログラム支援ユーティリティ
プログラムの終了
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)
環境と通信する
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
信号
Original:
Signals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
信号タイプ
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
非ローカルジャンプします
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
タイプ
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 );
ホストが指定した環境のリストとそれに関連付けられた情報を返しで名前env_varとの環境変数を検索します。環境変数と、それを変えるの一連のメソッドは実装定義である.
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.

目次

[編集] パラメータ

env_var -
を探すために、環境変数の名前を識別するNULLで終わる文字列
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.

[編集] 値を返します

このような変数が見つからない場合は文字列が環境変数またはNULLの値を識別する.
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.

[編集]

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

Possible output:

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

[編集] も参照してください

C documentation for getenv