Currently struggling with c++ as a I mostly been working with c# in the past. But this is my code:
template<typename fn> fn InterfaceManager::GetInterface(std::string modulename, std::string interfacename)
{
CreateInterfaceFn CreateInterface;
ASSERT(CreateInterface =(CreateInterfaceFn)GetProcAddress(GetModuleHandle(modulename), "CreateInterface"));
fn pInterface = 0;
for (int i = 100; i > 0; i--)
{
std::stringstream intf;
intf << interfacename << std::setfill('0') << std::setw(3) << i;
pInterface = (fn)(CreateInterface(intf.str().c_str(), 0));
if (pInterface) {
Log::Write(DEBUG,"%s found 0x%.8X", intf.str().c_str(), pInterface);
break;
}
}
return pInterface;
}
but I am getting the following error and I am not sure how to solve it
cannot convert argument 1 from 'std::string' to 'LPCSTR'