Re: Obtaining Current User Name
Re: Obtaining Current User Name
- Subject: Re: Obtaining Current User Name
- From: Russell Ahrens <email@hidden>
- Date: Fri, 8 Jun 2001 00:29:42 -0400
From the command line, there are two ways: "whoami" and checking the
USER or LOGNAME environment variable.
Programmatically, you can execute the system command "whoami", plop the
output into a string, and use that. As for the environment variable,
there is a UNIX extern C variable "environ". Check the man page for the
exact details, but it seems that you can search it for a string "USER="
(or "LOGNAME=") and keeping the text immediately following.
I hope that there's an easier way, through Cocoa, but I haven't found
anything yet. I'll keep looking.
Russell Ahrens
Oink Industries
On Thursday, June 7, 2001, at 08:53 PM, Karl Goiser wrote:
Hello,
Could somebody please tell me how to obtain information about the
currently logged in user?
(Sorry if this is a dumb question, but I really don't know where to
look...)
Karl
-- ----
Klaatu barada nikto
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev