Re: Equivalent to Windows API 'GetUserName()'
Re: Equivalent to Windows API 'GetUserName()'
- Subject: Re: Equivalent to Windows API 'GetUserName()'
- From: Henry McGilton <email@hidden>
- Date: Thu, 5 Jun 2003 19:24:21 -0700
On Thursday, June 5, 2003, at 06:46 PM, Andy Satori wrote:
I'm certain this is dead easy and I'm just overlooking it, but I want
to find out the current user's name from Objective C. I don't see any
foundation objects that look like they fit the bill.
In Windows, I would simply call the GetUserName() API call:
char *szUser;
DWORD cbUser = MAX_PATH;
szUser = new char[cbUser];
GetUserName(szUser, &cbUser);
printf("Current User Name: %s\n", szUser);
delete szUser;
Unfortunately I don't see an equivalent. I'm assuming I need
something from the Core Foundation to do this, but I'm not entirely
certain where to even look. Any suggestions?
Take a look at NSUserName and NSFullUserName. They are
in 'Path Utilities' ( ? ! ? ) in Foundation Functions . . .
Best Wishes,
........ Henry
===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden |
http://www.trilithon.com
|
===============================+============================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.