Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
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



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>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.