Background information: Windows 7, Visual C ++ 2010 Express
Problem: CreateProcess () continues to return using "Invalid command line argument"
Explanation: I am writing a piece of code that calls external programs using the Windows API CreateProcess. I got a call to work with one external program:
if( !CreateProcess( "C:\\Temp\\convert.exe", t_str, // Arguments ... } //where t_str is " C:\\img1.jpeg C:\\img1.pgm" (ImageMagick if you're wondering).
This works great even with the amount of data processing that I did to insert everything into Windows strings and pointers. Therefore, I copied all the mechanisms for CreateProcess () to another call to another external program:
if( !CreateProcess( "C:\\Temp\\sift.exe", t_str2, // Arguments ... } //where t_str2 is ` < C:\\img1.pgm > C:\\img1.key`
In principle, something very similar, but with the change of all variable names (since I have these two calls performed in series). And here is the problem; it does not start and instead displays "Invalid command line argument: <C: \ img1.pgm". Of course, this command works fine on the command line, but not in my code.
I switched t_str2 to something else a little less complicated (since I know how sift.exe works) and I get the same result. The same thing happens when I run just sifting and not converting.
Question: What could be causing this problem? What can I do to further debug this problem? Any suggestions on alternatives to the methods I use? Any help is appreciated. I can provide additional code, but it is pretty straightforward, and little can go wrong.
source share