[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Determining the length of an objCType

From: Andreas Hoeschler
Subject: Determining the length of an objCType
Date: Mon, 9 Dec 2002 20:00:38 +0100

Hi all,

I need to encode NSValue on my own (in a category of NSValue). The primitives of NSValue are:

- (const char *)objCType
- (void)getValue:(void *)buffer

I would like to do something like

const char *objCType = [self objCType];
int length = sizeof(objCType); // <-----------
void *buffer = malloc(length);
[self getValue:buffer];
[archiver encodeString:[NSString stringWithCString:objCType] withName:@"type"];
[archiver encodeData:[NSData dataWithBytes:buffer length:length] withName:@"value"];

The marked line of course is incorrect. But how can I get the necessary buffer size from an objC type?

Thanks a lot,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]