Re: CString Array to LPCTSTR *



One of the things I hate about string STL is there is no equivalent of
CString GetBuffer(...)/ReleaseBuffer(...) which comes handy when we need to
pass pointer to string to win32apis like RegQueryValue(...)

--
Vipin Aravind
http://www.explorewindows.com/Blogs


"Ajay Kalra" <ajaykalra@xxxxxxxxx> wrote in message
news:1158605106.025846.189620@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Saul775 wrote:
Is it possible to convert a CString array to a 2D array of TSTR, so that
I
might pass it into a function?

For example...

CString words[] = {"Hello", "How", "Are", "You"};

void MyFunc(LPCTSTR *words, int nSize)
{
...
}

Saul775


Use std::vector or CStringArray.

---
Ajay



.



Relevant Pages

  • Re: point me...
    ... Well passing objects by Reference is very similar in concept to Pointers. ... In reality the CString objects pointer is being placed on the stack and ... I hear horror stories about memory leaks. ...
    (microsoft.public.vc.mfc)
  • Re: Assigning a BSTR to a CString
    ... that NULL pointer. ... in fact it was a exception raised by the CString ... You said that you but the string into a database. ... They can happily work with a BSTR which is also ...
    (microsoft.public.vc.atl)
  • Re: CFileDialog drives me insane. Handle Problem ?
    ... The basic type you care about is CString. ... This is the equivalent to the Java 'String' ... There are rare cases in which you need a LPTSTR pointer, ... const wchar_t * - const pointer to Unicode characters. ...
    (microsoft.public.vc.mfc)
  • Re: CFileDialog drives me insane. Handle Problem ?
    ... The basic type you care about is CString. ... This is the equivalent to the Java 'String' ... There are rare cases in which you need a LPTSTR pointer, ... const wchar_t * - const pointer to Unicode characters. ...
    (microsoft.public.vc.mfc)
  • Re: TCHAR* and PostMessage in a thread .. memory leak question
    ... the CString pointer will probably work better than making a new variable ... > And yes, if the PostMessage fails to send, or if the receiver fails to ...
    (microsoft.public.vc.mfc)

Loading