#include <pwd.h>
#include<sys/types.h>
#include<unistd.h>
if (geteuid() == 0) { LOGI("running from root user"); } struct passwd *pw = getpwuid(getuid()); const char *homedir = pw->pw_dir;
fseek(f, 0, SEEK_END); long pos = ftell(f); fseek(f, 0, SEEK_SET);
原文:https://www.cnblogs.com/fogcell/p/8806773.html