The problem is, that these are outside the language and more in operating system territory.
On Unix-like operating system you'd use "getenv", for example
#include <stdlib.h>
char * home = getenv("HOME");
And you can use the "stat" function to get all kinds of information about a file.
#include <sys/types.h>
#include <sys/stat.h>
int stat(const char *path, struct stat *sb);