Problems using system() to call convert.exe in a C app
Posted: 2010-02-23T15:26:05-07:00
Hello!
I am writing a small C application which uses system() to call convert.exe in order to convert any image file to a 24-bit BMP image.
I have downloaded the "ImageMagick-6.5.9-Q16-windows.zip" file and I'm using the convert.exe file from that release, since it doesn't need external .DLL files.
Here is how I call the convert utility:
sprintf(command, "%s \"%s\" BMP3:\"%s.bmp\"", ConvertPath, inFile, inFile);
int returnvalue = 0;
returnvalue = system(command);
It works fine on my system, however when I distributed the application people had problems with the convert utility (return value = 1).
It isn't any kind of path or missing problem, but rather DLL problems. In some cases, installing the Visual C++ Redistributable DLLs worked, however for many others it didn't do any difference and they still had problems with convert.exe (yes, I know that x64 needs another DLLs, but most people with problems aren't using 64-bit systems). Am I calling it wrong, or is there any compatibility problem with convert.exe? I'm puzzled to why it only works for some people.
I am writing a small C application which uses system() to call convert.exe in order to convert any image file to a 24-bit BMP image.
I have downloaded the "ImageMagick-6.5.9-Q16-windows.zip" file and I'm using the convert.exe file from that release, since it doesn't need external .DLL files.
Here is how I call the convert utility:
sprintf(command, "%s \"%s\" BMP3:\"%s.bmp\"", ConvertPath, inFile, inFile);
int returnvalue = 0;
returnvalue = system(command);
It works fine on my system, however when I distributed the application people had problems with the convert utility (return value = 1).
It isn't any kind of path or missing problem, but rather DLL problems. In some cases, installing the Visual C++ Redistributable DLLs worked, however for many others it didn't do any difference and they still had problems with convert.exe (yes, I know that x64 needs another DLLs, but most people with problems aren't using 64-bit systems). Am I calling it wrong, or is there any compatibility problem with convert.exe? I'm puzzled to why it only works for some people.