• 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: Checking OS Version with Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking OS Version with Cocoa


  • Subject: Re: Checking OS Version with Cocoa
  • From: MarketLogix Developer <email@hidden>
  • Date: Sat, 4 Jan 2003 18:04:40 -0800

I suggest the portable way when possible:

int platform( char *platformBuff )
{
struct utsname platform;
bzero(&platform,sizeof(platform));
if ( uname(&platform)<0 )
return errno;
sprintf(platformBuff,"<OS:%s>-<REV:%s>-<CPU:%s>",
platform.sysname, platform.release, platform.machine
);
return 0;
}

make sure that platformBuff can hold at least 32 bytes ...
This will compile & run under linux, FreeBSD, Sun Solaris (2.6 anyway)
and OSX.

Hope this helps,

bisk


On Saturday, January 4, 2003, at 02:50 PM, Bill Cheeseman wrote:

> on 03-01-04 5:12 PM, Jim Correia at email@hidden wrote:
>
>> On Saturday, January 4, 2003, at 04:56 PM, Chad Armstrong wrote:
>>
>>> Is there a way to check a machine's OS version using Cocoa? I've
>>> searched through some books, the web, and even these archives and
>>> didn't find anything right off hand. I've seen some Carbon code in
>>> doing this, but not Cocoa.
>>
>> Is there a reason why you can't just use the "Carbon" code?
>
> My book shows you a way to do it in Cocoa, and the technique is even
> sanctioned by Apple. It involves getting the version of the AppKit or
> Foundation and comparing it with published or easily found AppKit or
> Foundation versions for major releases of Mac OS X.
>
> But Jim's gestalt technique is easier, faster, and more accurate, so
> you
> should use it. In particular, the Cocoa technique doesn't distinguish
> intermediate "dot" releases, if I recall correctly.
>
> I'm in the middle of a big project that's mostly Cocoa, but I have to
> use a
> lot of Carbon and CoreServices stuff, too. They mesh together perfectly
> well, once you get used to it.
>
> --
>
> Bill Cheeseman - email@hidden
> Quechee Software, Quechee, Vermont, USA
> http://www.quecheesoftware.com
>
> The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
> Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
> Croquet Club of Vermont - http://members.valley.net/croquetvermont
> _______________________________________________
> 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.
_______________________________________________
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: Checking OS Version with Cocoa
      • From: Quentin Mathé <email@hidden>
    • Re: Checking OS Version with Cocoa
      • From: Bill Cheeseman <email@hidden>
References: 
 >Re: Checking OS Version with Cocoa (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: newbie question initWithCapacity
  • Next by Date: Re: newbie question initWithCapacity
  • Previous by thread: Re: Checking OS Version with Cocoa
  • Next by thread: Re: Checking OS Version with Cocoa
  • Index(es):
    • Date
    • Thread