• 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: Right way to check system version?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Right way to check system version?


  • Subject: Re: Right way to check system version?
  • From: Ron Fleckner <email@hidden>
  • Date: Sat, 20 May 2006 00:55:52 +1000


On 19/05/2006, at 7:43 PM, Greg Hurrell wrote:

Despite what the docs say, I've always used the Gestalt() function and never had any problems with it. Perhaps Gestalt is just reading that property list behind the scenes.

Cheers,
Greg

El 19/05/2006, a las 9:47, Ron Fleckner escribió:

I'd like to think there is a simpler, more direct way. I looked at Gestalt in the docs, but found this at the end of the section about System Version Selector:

On 19/05/2006, at 10:00 PM, Steve Checkoway wrote:
int main()
{
	OSErr err;
	long code;
	/* Get system version */
	err = Gestalt( gestaltSystemVersion, &code );
	if( err == noErr )
	{
		int major = ( (code >> 12) & 0xF ) * 10 + (code >> 8) & 0xF;
		int minor = (code >> 4) & 0xF;
		int revision = code & 0xF;

		printf( "Mac OS X %d.%d.%d\n", major, minor, revision );
	}
	return 0;
}

On 20/05/2006, at 12:06 AM, Finlay Dobbie wrote:
On 19/05/06, Steve Checkoway <email@hidden> wrote:
/* Get system version */
err = Gestalt( gestaltSystemVersion, &code );
if( err == noErr )
{
int major = ( (code >> 12) & 0xF ) * 10 + (code >> 8) & 0xF;
int minor = (code >> 4) & 0xF;
int revision = code & 0xF;

No need to extract the individual components, just have an comparison: if (code >= 0x1030) // we're on panther or newer

-- Finlay

Hehe, despite everyone's help, I think I'll stick with the slightly verbose Cocoa way, as I've never used much Carbon. But it's good to see some sample code which I mostly can understand and relates to what is said in the Carbon docs. That helps lots.


Cheers

Ron Fleckner _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Right way to check system version? (From: Ron Fleckner <email@hidden>)

  • Prev by Date: Re: can't get DOMDocument from WebView
  • Next by Date: Trouble using ANY operator in an NSArrayController search predicate
  • Previous by thread: Re: Right way to check system version?
  • Next by thread: Core Data: changes from second MOC not visible main MOC array controller.
  • Index(es):
    • Date
    • Thread