Search code examples
c++stringdllnativecstring

Native Dll Call with CStringArray


Consider the following code (Which works!):

int SetInputFile( const CString& fileName );

int SetInputFile(System::String^ fileName)
{
        const char* str = (char*)(void*)Marshal::StringToHGlobalAnsi(fileName);
        return m_Native->SetInputFile(str); 
}

How do I handle/convert a case with this input?

int SetInputFiles( const CStringArray& fileNames );

Solution

  • Thank you Alex Farber and Nostromoo After searching the web - I was unable to find and such conversion. There for I had the interface changed to receive a list of strings in a const CString& with a seperator character. Naturally your suggestions are as well good and valid solutions.