• 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
Re: Getting the user's name from cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the user's name from cocoa


  • Subject: Re: Getting the user's name from cocoa
  • From: Chris Kane <email@hidden>
  • Date: Tue, 3 Jul 2001 08:34:56 -0600

Well, I would advise:

NSString *yourUserName = NSUserName();
NSLog(@"%@", yourUserName);


Always use a real format string with any methods and functions that take them (including the ANSI C printf() etc.) rather than some random string/char pointer you got from somewhere. Especially if you're a beginner, ALWAYS use a format string even if nothing more than "%s", for example. You will save yourself trouble later when a user named " down" or whatever runs the app.


Chris Kane
Cocoa Frameworks, Apple

On Monday, July 2, 2001, at 10:23 PM, Pan wrote:

NSString *yourUserName = NSUserName();
NSLog(yourUserName);


On Monday, July 2, 2001, at 09:51 PM, Steve Woodward wrote:

Could someone post an example of using NSUserName for a beginner? Thanks in advance...


Sensory Research Network
http://sensoryresearch.com
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >Re: Getting the user's name from cocoa (From: Pan <email@hidden>)

  • Prev by Date: Re: NSMatrix problem
  • Next by Date: Re: pointer question
  • Previous by thread: Re: Getting the user's name from cocoa
  • Next by thread: object ownership question
  • Index(es):
    • Date
    • Thread