Link to home
Start Free TrialLog in
Avatar of ill_comms
ill_commsFlag for Australia

asked on

How define and update this string buffer

Hi All,
I've created a string buffer in VB and then call a c++ MFC dll with an external function as follows. I pass the buffer through by reference. Then...
What I'm not sure about is how declare it as a parameter to the function and populate it with a value from a CString variable.

The code below doesn't work but hopefully gives you an idea of where I'm heading. It's kind of like a API. Also the return value must non-unicode.

Any suggestions will be greatly appreciated.
int __declspec(dllexport) __stdcall ReadXML(CString &MtBuffer, int length, BSTR xmlFilePath, BSTR xmlNode)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
 
	CString str_xmlFilePath = BSTR2CString(xmlFilePath);
	CString str_xmlNode = BSTR2CString(xmlNode);
	
	CString	m_xml_value;
	m_xml_value = _T("");
	std::string _label;
	
	ParamIO inXml;
	inXml.readFile(str_xmlFilePath);
	inXml.read(str_xmlNode, _label, std::string(""));
	m_xml_value = _label.c_str();
	
	MtBuffer = m_xml_value;
	return 0;
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of alb66
alb66
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial