• 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
NSData to NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Broken Nib
  • Next by Date: Re: Long to C-String
  • Previous by thread: Fwd: Transferring Projects to new Computer
  • Next by thread: Reading a legacy file format
  • Index(es):
    • Date
    • Thread