我想使用C代码转到主目录。如何从代码访问$HOME?
发布于 2011-10-12 10:23:10
它不仅仅是一个bash变量,它还是一个环境变量。看一看getenv
getenv
#include <stdlib.h> ... // The value will be NULL if the variable doesn't exist char* home = getenv("HOME");
https://stackoverflow.com/questions/7734567
相似问题