on 06/11/11 8:21, Stephan Cleaves at email@hidden wrote:
> This can be achieved with the SystemConfiguration framework.
Thanks. getuid() returns 0, but this gives the name, user ID and group ID
if you need them..........
#import <SystemConfiguration/SCDynamicStoreCopySpecific.h>
NSString* GetConsoleUser(uid_t* p_uid, gid_t* p_gid) ;
// Will return nil if no current console user.
// You may pass NULL as argument(s) if not interested in
// user ID (uid: 501, 502, etc) or group ID (gid).
NSString* GetConsoleUser(uid_t* p_uid, gid_t* p_gid) {
NSString* name = (NSString*)SCDynamicStoreCopyConsoleUser(
NULL, p_uid, p_gid);
return([name autorelease]) ;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
This email sent to email@hidden