If the main app is always running, you can use an environment variable...
The following example changes the value of the HOME environment variable to the value /usr/home.
#include <stdlib.h>
...
static char *var = "HOME=/usr/home";
int ret;
ret = putenv(var);