#include <stdlib.h> int putenv(char *env) env : 環境変数とその値を次のような形式で与えます. 変数=文字列 また,環境変数を削除したいときは,NULL の文字列,つまり, 変数= のように与えます.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int sw;
char *str;
sw = putenv("BAS=c:\\basic");
str = getenv("BAS");
printf("sw %d 環境変数 BAS の値は %s\n", sw, str);
return 0;
}
sw 0 環境変数 BAS の値は c:\basic
| 菅沼ホーム | 本文目次 | 演習問題解答例 | 付録目次 | 索引 |