I have a program where I need to execute an .exe to convert images to DDS before I can use them in my program. To do this, I have a function where I can pass a command to system() like so:
unsigned int __stdcall Scene::ExecuteCommand(void* command)
{
return system(static_cast<char*>(command));
}
I was thinking the other day that perhaps this is unsafe/dangerous but I'm not 100% sure if it is or not (and if it is, how it is unsafe/dangerous). The function works as intended but is this bad practice? Should I be concerned?
My question is not a duplicate because I am asking about the specifics and the impact of using system() inside of a function. My function allows for any command line argument to be passed to system in a multi-threaded fashion.