Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Newbie question: error in creating a NSData object using handle (Resource Management)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie question: error in creating a NSData object using handle (Resource Management)



Wow, thanks Ken a lot.About the endian issues, I have a compatible swap
function to convert data to Big-endian (and vice verse).
Then, I will correct big-endian issues.
I may know where the problem is.
When I read to your suggestion,

On Fri, Jun 27, 2008 at 6:11 AM, Ken Thomases <email@hidden> wrote:
>
>
>>
>> data = [NSData dataWithBytes:*dataHandle length:sizeLong ];
>>
>>       resID = [NSNumber numberWithShort:resIDShort];
>>
>> if((type2 =='PREC')&&([resID intValue]== 302))
>>
>> {
>>
>>   struct PGControlRes pgControlRes;
>>
>> memcpy(&pgControlRes,[data bytes], [data length]);
>>
>
> Have you tested that the resource size is the same as the structure size?


I found out something.
Actually, I'm just trying to make a prototype in one fixed size of the same
resource type.
I used to test on the same resource files with this fixed resource
structure.
but in reality, in my application, the resource size for this type(PREC) is
various for each resource file(.rsrc).
So, I think the struct caused my problem ( I never thought of it before).
By the way, I have a lot of structs of the same resource type(PREC for
example) written in C,
Is there any way to still take advantage of them in Objective-C?
(I mean if I can use these C structs in Objective-C?, don't have to rewrite
them using Objective-C language).
Thank you for your supports.

---(Bachtk
_______________________________________________

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: 
 >Newbie question: error in creating a NSData object using handle (Resource Management) (From: "Tran Kim Bach" <email@hidden>)
 >Re: Newbie question: error in creating a NSData object using handle (Resource Management) (From: Ken Thomases <email@hidden>)
 >Re: Newbie question: error in creating a NSData object using handle (Resource Management) (From: "Tran Kim Bach" <email@hidden>)
 >Re: Newbie question: error in creating a NSData object using handle (Resource Management) (From: Kai <email@hidden>)
 >Re: Newbie question: error in creating a NSData object using handle (Resource Management) (From: "Tran Kim Bach" <email@hidden>)
 >Re: Newbie question: error in creating a NSData object using handle (Resource Management) (From: Ken Thomases <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.