• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Equivalent to Windows API 'GetUserName()'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Equivalent to Windows API 'GetUserName()'


  • Subject: Equivalent to Windows API 'GetUserName()'
  • From: Andy Satori <email@hidden>
  • Date: Thu, 5 Jun 2003 21:46:37 -0400

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?

Andy Satori - Druware Software Designs - email@hidden
_______________________________________________
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.

  • Follow-Ups:
    • Re: Equivalent to Windows API 'GetUserName()'
      • From: Ryan Stevens <email@hidden>
    • Re: Equivalent to Windows API 'GetUserName()'
      • From: mathew <email@hidden>
    • Re: Equivalent to Windows API 'GetUserName()'
      • From: Henry McGilton <email@hidden>
References: 
 >string encoding (From: Lloyd Dupont <email@hidden>)

  • Prev by Date: Re: OT: Where's flockfile
  • Next by Date: Re: Comments & Documentation (was Re: semantics of init)
  • Previous by thread: string encoding
  • Next by thread: Re: Equivalent to Windows API 'GetUserName()'
  • Index(es):
    • Date
    • Thread