[ILUG] finding user name from inside a C program
paul at clubi.ie
Tue Sep 20 15:30:27 IST 2005
On Tue, 20 Sep 2005, Joseph Manning wrote:
> Does anyone know how to safely and easily determine the user name
> of someone running a C program?
printf("user: %s\n", (getpwuid(getuid()))->pw_name);
Paul Jakma paul at clubi.ie paul at jakma.org Key ID: 64A2FF6A
Light travels faster than sound.
This is why some people appear bright until you hear them speak.
More information about the ILUG