• 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: Getting an NSString out of an NSTextView;
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting an NSString out of an NSTextView;


  • Subject: Re: Getting an NSString out of an NSTextView;
  • From: Nick Zitzmann <email@hidden>
  • Date: Tue, 10 Feb 2004 16:42:08 -0800

On Feb 10, 2004, at 3:59 PM, Robert Tillyard wrote:

I have an NSTextView which the user enters text, I need to pass the contents as a "const char *" to a 'C' library to save to an ISAM database.

How do I get the the [NSString cString]? I seem to need to navigate NSTextStorage but I'm getting lost in the documentation.

NSTextStorage is a subclass of NSMutableAttributedString, which is a subclass of NSAttributedString, so doing something like this ought to work (where "textView" is the name of the NSTextView):

const char *cText = [[[textView textStorage] string] UTF8String];

Nick Zitzmann
<http://seiryu.home.comcast.net/>
<http://www.freshlysqueezedsoftware.com/>
S/MIME signature available upon request

UNIX: Where /sbin/init is Job #1.
_______________________________________________
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.

References: 
 >Getting an NSString out of an NSTextView; (From: Robert Tillyard <email@hidden>)

  • Prev by Date: Re: variadic variable argument list in #define
  • Next by Date: Re: Simple File Data Reading Question
  • Previous by thread: Re: Getting an NSString out of an NSTextView;
  • Next by thread: Re: Getting an NSString out of an NSTextView;
  • Index(es):
    • Date
    • Thread