C系统("echo $HOME");想知道$HOME指向什么
本文关键字:HOME quot 什么 想知道 echo 系统 | 更新日期: 2023-09-27 18:15:29
C语言编程:希望在系统命令中使用特殊字符。系统("echo $ HOME");我想要$HOME系统变量,而不是字面的$HOME。谢谢,基斯
#include <stdio.h> // for printf()
#include <stdlib.h> // for getenv()
int main()
{
char *home;
home = getenv("HOME");
printf("Value is = %s'n", home);
}