用C编程:想在系统命令中使用特殊字符。 system(“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); }