• 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: Reading Adobe Photoshop header, Obj-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading Adobe Photoshop header, Obj-C


  • Subject: Re: Reading Adobe Photoshop header, Obj-C
  • From: Francis Devereux <email@hidden>
  • Date: Tue, 28 Jun 2011 22:27:18 +0100

On 28 Jun 2011, at 18:00, Jens Alfke wrote:

> Another way (that I often use) is to define a C struct that matches the fields and layout of the header, then cast the bytes to a pointer to that struct and read the fields. It makes your code look a lot cleaner, but you have to be careful to (a) make sure the compiler packs the struct fields properly

You can do this with __attribute__((packed)) - see http://developer.apple.com/library/mac/#documentation/DeveloperTools/gcc-4.2.1/gcc/Type-Attributes.html. Be aware that __attribute__((packed)) is a GCC extension though, so it may not be supported by other compilers.

Francis

_______________________________________________

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

References: 
 >Reading Adobe Photoshop header, Obj-C (From: Kevin Muldoon <email@hidden>)
 >Re: Reading Adobe Photoshop header, Obj-C (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Reading Adobe Photoshop header, Obj-C
  • Next by Date: Re: Menu Title Icon in Cocoa
  • Previous by thread: Re: Reading Adobe Photoshop header, Obj-C
  • Next by thread: Re: Reading Adobe Photoshop header, Obj-C
  • Index(es):
    • Date
    • Thread