• 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 Computer Name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Computer Name


  • Subject: Re: Getting Computer Name
  • From: "email@hidden" <email@hidden>
  • Date: Sun, 20 Jun 2010 15:04:02 +0100

On 20 Jun 2010, at 14:46, Steve Steinitz wrote:

> Hi Paul,
>
> On 20/6/10, Paul Sanders wrote:
>
>>>> Are you #including <CoreServices/CoreServices.h>?
>>
>>> I wasn't.  I added it.  Were you wondering if it would make a difference?

The correct import is #import <SystemConfiguration/SCDynamicStoreCopySpecific.h>.
Omitting it causes the compiler to assume integer return type.

I do get the expected warnings:
warning: implicit declaration of function 'SCDynamicStoreCopyComputerName'
warning: initialization makes pointer from integer without a cast

I wouldn't fancy living without these.

>>
>> Well, yes.  Default return type is int.  In fact I'm suprised you
>> didn't get a warning about the function being undefined.  My Mac is
>> powered off or I would check.  Does adding the #include sort things
>> out?
>
> No, it doesn't seem to make a difference.  I might raise a bug report.  in the meantime I'm using:
>
>    [[NShost currentHost] name];
This can really block. Sometimes unexpectedly, depending on your machine configuration.
I wouldn't touch it for all the beer on Bondi.

Jonathan


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Getting Computer Name
      • From: Steve Steinitz <email@hidden>
    • Re: Getting Computer Name
      • From: "Paul Sanders" <email@hidden>
References: 
 >Re: Getting Computer Name (From: Steve Steinitz <email@hidden>)

  • Prev by Date: Re: Getting Computer Name
  • Next by Date: Re: Getting Computer Name
  • Previous by thread: Re: Getting Computer Name
  • Next by thread: Re: Getting Computer Name
  • Index(es):
    • Date
    • Thread