• 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
Re: Strings from UUID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strings from UUID


  • Subject: Re: Strings from UUID
  • From: Jeremy Dronfield <email@hidden>
  • Date: Fri, 9 Aug 2002 19:33:51 +0100

On Friday, August 9, 2002, at 06:32 pm, I wrote:

Could someone show me a reliable way (with code example if poss) of creating a UUID, turning it into a CString, then into an NSString.

I tried to RTFM, but the F thing was F incomprehensible.

Well, I RTFM again, and it turns out it has a F serious typo. It's in Core Foundation Utility Services Tasks. In case you ever need to use it, for "kCFDefaultAllocator", read "kCFAllocatorDefault". I only picked up on this when I trawled the section on dates looking for clues.

However, since I'm replying to my own post, I thought I'd include the code I've used, in case anyone has any comments/criticisms:

- (IBAction)generateAction:(id)sender
{
NSString *myString;
CFUUIDRef myUUID;
CFStringRef myUUIDString;
char strBuffer[100];

myUUID = CFUUIDCreate(kCFAllocatorDefault);
myUUIDString = CFUUIDCreateString(kCFAllocatorDefault, myUUID);

CFStringGetCString(myUUIDString, strBuffer, 100, kCFStringEncodingASCII);
myString = [NSString stringWithFormat:@"%s", strBuffer];
[textView1 setString:myString];
}
I'd appreciate any input, as this is the first time I've used Core Foundation.
-Jeremy

=======================================
email@hidden // email@hidden
The Alchemy Pages:
- fractious fiction at http://freespace.virgin.net/jeremy.dronfield
_______________________________________________
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: Strings from UUID
      • From: Jim Correia <email@hidden>
References: 
 >Strings from UUID (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Re: FTPClient Beta Released - Please test
  • Next by Date: Re: Strings from UUID
  • Previous by thread: Strings from UUID
  • Next by thread: Re: Strings from UUID
  • Index(es):
    • Date
    • Thread