> How do I programmatically find out in C who the current user (i.e. user
> executing the program)?

use getuid and then look that up in the /etc/passwd file. Not hard if you
know what you're doing.

if ((fpIn = fopen ("/etc/passwd", "r")) == NULL)
{
   // error
}
while (!feof(fpIn))
{
   char * szTemp = fgets (fpIn) ;
   //see if user's id is in the string you just read from the file
   // strstr() if I recall correctly
}
close (fpIn) ;


Cheers,
---
Ian Douglas, Wild Web Services
http://www.wildwebservices.com
ph: 613-253-3147
fx: 613-253-1029
pager: http://wildwebservices.com/pager.html

Reply via email to