• 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
putting structs in NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

putting structs in NSArray


  • Subject: putting structs in NSArray
  • From: Ben Dougall <email@hidden>
  • Date: Tue, 26 Aug 2003 12:09:03 +0100

hiyer,

this works fine for an NSRange:

NSRange r = NSMakeRange(50, 5);
NSValue *v = [NSValue valueWithBytes:&r objCType:@encode(NSRange)];
[array addObject: v]; // puts encoded struct into NSMutableArray

but what about with another struct like say:

struct str {
int x;
char y;
BOOL z;
};

struct str s = {123456, '*', YES};

how can i now add s into an NSMutableArray?

thanks, ben
_______________________________________________
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.

  • Follow-Ups:
    • Re: putting structs in NSArray
      • From: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: Re: Help me, which book I should buy to learn Cocoa??
  • Next by Date: Re: Highlighting labels
  • Previous by thread: Bug in NSImage?
  • Next by thread: Re: putting structs in NSArray
  • Index(es):
    • Date
    • Thread