• 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
How to get system version?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to get system version?


  • Subject: How to get system version?
  • From: Chad Jones <email@hidden>
  • Date: Fri, 17 Oct 2003 10:21:11 -0700

Hi Giovanni,

You can easily get the system version using the Carbon Gestalt call.
Code I provided below gets and prints out the system version. This
code works from both Carbon and Cocoa you need only include the
Carbon framework in your application.

long SystemVersionInHexDigits;
long MajorVersion, MinorVersion, MinorMinorVersion;

error = Gestalt(gestaltSystemVersion, &SystemVersionInHexDigits);

MinorMinorVersion = SystemVersionInHexDigits & 0xF;

MinorVersion = (SystemVersionInHexDigits & 0xF0)/0xF;

MajorVersion = ((SystemVersionInHexDigits & 0xF000)/0xF00) * 10 +
(SystemVersionInHexDigits & 0xF00)/0xF0;


printf("%ld.%ld.%ld", MajorVersion, MinorVersion, MinorMinorVersion);


> I wanna perform different code whether I'm in Jaguar or in Panther.
>But keeping the same application.
>
>can I get the system version somehow so that I can do:
>
>if (PANTHER_INSTALLED)
>{
>
>}
>else if (JAGUAR_INSTALLED)
>{
>
>}
>else if (PUMA_INSTALLED)
>{
>
>}
>
>Thanks for your help!
_______________________________________________
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.

  • Prev by Date: Re: Trapping insert nil value into dictionary?
  • Next by Date: setPropertyList forType / propertyListForType problem on 10.2.8
  • Previous by thread: Re: How to get system version?
  • Next by thread: Displaying a checkbox (NSButton) alongside text in NSOutlineView
  • Index(es):
    • Date
    • Thread