Re: direct access to ns[C]String buffer
Benjamin Smedberg <[email protected]> Mon, 11 Nov 2002 13:52:40 -0500
| Newsgroups | gmane.comp.mozilla.devel.xpcom |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Brodie Thiesfield wrote: > Is there any way to get direct access to a buffer in a string class > similar to the MFC CString::GetBuffer()/CString::ReleaseBuffer() pair? > > terminated string into it. I want to assign this string to a nsCString > which is returned from the interface. The easiest way would be to > request the string to have the max size buffer, write the data The "proper" way is to allocate the buffer and fill it, then use the ns[C]String .Adopt() member function. The ns[C]String class then owns the buffer and will deallocate it when deleted. -Ben Smedberg