How can I get the actual \"username\" without using the environment (getenv, ...) in a program?
Use char *cuserid(char *s) found in stdio.h.
#include
#define MAX_USERID_LENGTH 32
int main()
{
char username[MAX_USERID_LENGTH];
cuserid(username);
printf("%s\n", username);
return 0;
}
See for more details: