string - how to use a variable in parameters -


i need know how use variable in parameters process initalized string process in class parameters.

process::getprocessesbyname("") 

which gives me error when replace string variable

process::getprocessesbyname(process) 

the error is: no instance of overloaded function "system::diagnostics::process::getprocessbyname" matches argument list argument types (std::string)

i think getprocessesbyname may take parameter lpstr or char const *, not std::string,

try use

process::getprocessesbyname(process.c_str()); 

or if process defined std::string process;,

   string^ process_name = gcnew string(process.c_str());    process::getprocessesbyname(process_name); 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -