Re: get current user name?
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Fri, 19 Aug 2005 18:05:28 GMT
Alan Balmer <albalmer@xxxxxxx> writes:
> On Fri, 19 Aug 2005 06:33:21 GMT, rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard
> Bos) wrote:
>
>>djbitchpimp@xxxxxxxxxxxxx wrote:
>>
>>> How do I retrieve the username of the currently logged in user? I
>>> basically to check if the user is logged in as root and if not, exit
>>> the program.
>>
>>You call GetUserName, which is declared in <winbase.h>...
>
> Odd - I can't seem to find either the function or the include file
> mentioned in the C standard, or even the POSIX standard. Are you sure
> you're in the right newsgroup?
Yes, he's sure he's in the right newsgroup; that's the point he was
trying to make. See the "oops" below.
>>> I though about using the LOGNAME environment variable, but if a regular
>>> user used su root,
>>
>>...oops.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- get current user name?
- From: djbitchpimp
- Re: get current user name?
- From: Richard Bos
- Re: get current user name?
- From: Alan Balmer
- get current user name?
- Prev by Date: Re: compare a large number of variables
- Next by Date: Re: compare a large number of variables
- Previous by thread: Re: get current user name?
- Next by thread: getting variable length strings from stdin
- Index(es):
Relevant Pages
|