Re: NSTableView and displaying c strings
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