NSData to NSString
NSData to NSString
- Subject: NSData to NSString
- From: David Blanton <email@hidden>
- Date: Mon, 07 Apr 2003 17:50:54 -0600
Let me try this again. What I am trying to do is get a list of nukmeric
results from an apple script and then use these as NSStrings.
NSAppleEventDescriptor * theDescriptor = [theScript
executeAndReturnError:nil];
int x = [theDescriptor numberOfItems];
int i,l;
long lo;
Str255 str;
NSData * theData;
NSString * recid;
char buffer[16];
for(i = 1;i<x+1;i++)
{
NSAppleEventDescriptor * aDescriptor = [theDescriptor
descriptorAtIndex:i];
theData = [aDescriptor data];
l = [theData length];
[theData getBytes:buffer];
BlockMoveData(buffer,&lo,l);
NumToString(lo,str);
recid = [[NSString alloc] initWithCString:&str[1] length:str[0]];
}
Is there a better solution, hey Bill Chessman, give me your thoughts.
Thanks to all.
David Blanton
"Cocoa FNG"
_______________________________________________
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.