• 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: David McGavern <email@hidden>
  • Date: Tue, 10 Feb 2004 20:10:20 -0500

To get an NSString (which you can then get a C string from), call:

[myTextView string];

The documentation on NSText (which NSTextView is a subclass of) says
this about the string method:

"Returns the characters of the receivers text. For performance
reasons, this method returns the current backing store of the text
object. If you want to maintain a snapshot of this as you manipulate
the text storage, you should make a copy of the appropriate substring."

Hope that helps!

- David McGavern

On Feb 10, 2004, at 6: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.
>
> Thanks, Regards, Rob.
> _______________________________________________
> 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.
_______________________________________________
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: Getting an NSString out of an NSTextView;
  • Next by Date: Re: applicationShouldTerminateAfterLastWindowClosed
  • Previous by thread: Re: Getting an NSString out of an NSTextView;
  • Next by thread: Scrolling two NSTableView with one scrollbar
  • Index(es):
    • Date
    • Thread