• 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: NSTableView and displaying c strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView and displaying c strings


  • Subject: Re: NSTableView and displaying c strings
  • From: David Duncan <email@hidden>
  • Date: Fri, 30 Nov 2007 15:46:16 -0800

On Nov 30, 2007, at 3:23 PM, Chinh Nguyen wrote:

What I did for my tableView:objectValueForTableColumn:row: method is convert the c string for a given column and row to an NSString and return it (my simplified example assumes just one column).

// VarName() is a wrapper for returning the pointer to a null- terminated c string given an index
string = [[NSString alloc] initWithCString:VarName(row)
encoding:NSMacOSRomanStringEncoding];
return(string);
}

You can use [NSString stringWithCString:encoding] instead of [NSString initWithCString:encoding] and the returned string will be autoreleased (that is, released "later") and then you won't have to worry about the reference count.


And while you can't change the format of the code today, you may want to consider a plan to migrate your data to UTF-8 at the least (or perhaps it already is and your just using the wrong encoding above?).
--
David Duncan
Apple DTS Animation and Printing
email@hidden




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSTableView and displaying c strings (From: Chinh Nguyen <email@hidden>)

  • Prev by Date: NSTableView and displaying c strings
  • Next by Date: Programmatically change NSMatrix cells' type?
  • Previous by thread: NSTableView and displaying c strings
  • Next by thread: Programmatically change NSMatrix cells' type?
  • Index(es):
    • Date
    • Thread