Problem related to CString usage.
Posted on 2013-01-21
This should be easy, but I can't figure it out. I'm trying to call a function from MFC based C++ code. The function signature is:
Add(HZIP hz, const TCHAR *dstzn, void *src, unsigned int len, DWORD flags);
The 3rd parameter is what is causing my problem. It is supposed to be the full path and file name of a file to be taken into a process. In my case that full path is contained in a CString object. I've tried several ways to get the CStrinng content into an acceptable format, but I cannot get anything to work. For example, if I use the CString directly, I get the compiler complaint:
C2664: Add: cannot convert parameter 3 from 'CString' to 'void *'
if I try (LPCSTR)CString I get:
C2664: 'Add' : cannot convert parameter 3 from 'LPCSTR' to 'void *'
Any help would be appreciated. Thanks