-1
私はubuntu 14.04を使用しています。プログラムの中でmain()の先頭に次のコードを追加しましたが、実行すると何も表示されません。getenv()は同じ環境変数の異なるプログラムで異なる値を返します
char const* masteruri = getenv("ROS_MASTER_URI");
if (masteruri!=NULL){
printf ("The current masteruri is: %s",masteruri);
}
char const* rosdis = getenv("ROS_DISTRO");
if (rosdis!=NULL){
printf ("\n The current rosdis is: %s",rosdis);
}
が、別のプログラムで同じコードが期待された結果
The current masteruri is: http://localhost:11311
The current rosdis is: indigo
を与える私はSTDLIB.Hが含まれていると私は私がいないなど/のprofile.d
_in a program_、_別のプログラム_ **何**プログラムですか? –
また、どのようにこれらのプログラムを実行するのですか、コンテキストは非常に重要です。 – gonutz