Re: API for fetching the computer name in cocoa

2009-06-12 Thread Gerriet M. Denkmann
On 12 Jun 2009, at 15:21, Bill Monk wrote: On Jun 12, 2009, at 5:43 AM, "Gerriet M. Denkmann" wrote: StringPtr c = (void *)response; NSUInteger cle = *c; char *cu = malloc( cle + 1); memcpy( cu, c + 1, cle); cu[

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Arie Pieter Cammeraat
Won't CSCopyMachineName do the job? Op 12-jun-2009, om 8:24 heeft Gerriet M. Denkmann het volgende geschreven: On 11 Jun 2009, at 18:55, Graham Cox wrote: On 12/06/2009, at 2:08 AM, Arun wrote: Hi All, Is there any API in cocoa which can be used to fetch computer name which is gettin

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Greg Guerin
Eric Schlegel wrote: However, be aware that [[NSHost currentHost] name] can block for an exceedingly long time, so if you use it, always call it on a thread; and some of other API recommended here, such as SCDynamicStoreCopyComputerName, is probably a better choice. And beware that "comp

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Michael Ash
On Fri, Jun 12, 2009 at 12:44 PM, Eric Schlegel wrote: > > On Jun 12, 2009, at 7:14 AM, Adam R. Maxwell wrote: > >> There is also NSHost, which has -name and -names. > > However, be aware that [[NSHost currentHost] name] can block for an > exceedingly long time, so if you use it, always call it on

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Eric Schlegel
On Jun 12, 2009, at 7:14 AM, Adam R. Maxwell wrote: There is also NSHost, which has -name and -names. However, be aware that [[NSHost currentHost] name] can block for an exceedingly long time, so if you use it, always call it on a thread; and some of other API recommended here, such as

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Adam R. Maxwell
On Jun 12, 2009, at 12:37 AM, Gerriet M. Denkmann wrote: Amazing how many ways to get a hostname do exist! There is also NSHost, which has -name and -names. smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Coco

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Bill Monk
On Jun 12, 2009, at 5:43 AM, "Gerriet M. Denkmann" wrote: StringPtr c = (void *)response; NSUInteger cle = *c; char *cu = malloc( cle + 1); memcpy( cu, c + 1, cle); cu[cle] = '\0'; NSLog(@"%s gestal

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Gerriet M. Denkmann
On 12 Jun 2009, at 09:08, Tito Ciuro wrote: Hi Arun, How about -[NSProcessInfo hostname]? Check the following document for more info: I just added this to my code: NSProcessInfo *pi = [ [ NSProcessInfo alloc ] init ]; NSString *d = [ pi hostName ];

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Gerriet M. Denkmann
On 12 Jun 2009, at 08:58, Graham Cox wrote: On 12/06/2009, at 4:24 PM, Gerriet M. Denkmann wrote: On 11 Jun 2009, at 18:55, Graham Cox wrote: On 12/06/2009, at 2:08 AM, Arun wrote: Hi All, Is there any API in cocoa which can be used to fetch computer name which is getting displayed in

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Tito Ciuro
Hi Arun, How about -[NSProcessInfo hostname]? Check the following document for more info: http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSProcessInfo_Class/Reference/Reference.html Regards, -- Tito On Jun 11, 2009, at 11:58 PM, Graham Cox wrote: On 12/06/20

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Graham Cox
On 12/06/2009, at 4:24 PM, Gerriet M. Denkmann wrote: On 11 Jun 2009, at 18:55, Graham Cox wrote: On 12/06/2009, at 2:08 AM, Arun wrote: Hi All, Is there any API in cocoa which can be used to fetch computer name which is getting displayed in Finder? I'm not sure if there's a better way

Re: API for fetching the computer name in cocoa

2009-06-11 Thread Gerriet M. Denkmann
On 11 Jun 2009, at 18:55, Graham Cox wrote: On 12/06/2009, at 2:08 AM, Arun wrote: Hi All, Is there any API in cocoa which can be used to fetch computer name which is getting displayed in Finder? I'm not sure if there's a better way, but you can use the Gestalt function with the gestaltUs

Re: API for fetching the computer name in cocoa

2009-06-11 Thread Greg Guerin
Arun wrote: Is there any API in cocoa which can be used to fetch computer name which is getting displayed in Finder? CSCopyMachineName -- GG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderato

Re: API for fetching the computer name in cocoa

2009-06-11 Thread Sidney San Martín
You can use the System Configuration framework to retrieve the computer name: NSString *computerName = [(NSString*)SCDynamicStoreCopyComputerName(NULL, NULL) autorelease]; -Sidney On Thu, Jun 11, 2009 at 12:08 PM, Arun wrote: > Hi All, > > Is there any API in cocoa which can be used to fetch co

Re: API for fetching the computer name in cocoa

2009-06-11 Thread Graham Cox
On 12/06/2009, at 2:08 AM, Arun wrote: Hi All, Is there any API in cocoa which can be used to fetch computer name which is getting displayed in Finder? I'm not sure if there's a better way, but you can use the Gestalt function with the gestaltUserVisibleMachineName selector. --Graham

API for fetching the computer name in cocoa

2009-06-11 Thread Arun
Hi All, Is there any API in cocoa which can be used to fetch computer name which is getting displayed in Finder? Thanks Arun ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Co