I'm trying to automate the generation of trees with Arbaro and POV-Ray (since Arbaro, oddly, lacks the option to bulk render trees). I've got main part of the code working where the scene file is updated, the seed is set, and all that. The only thing left is executing the needed programs from within my own program. I've tried so many different approaches but nothing is working. I'm often getting weird and unexpected results. This screenshot shows what's going on. I'm using exactly the same command line with my own program and that in command prompt but I get 2 totally different results.
Command Prompt works just fine but my own program is not. From fiddling around with things, I found a big clue. When I tried to execute other programs other than Java, I find that they execute just fine - cmd, dir, my hex editor, Virtual Dub, and even the required POV-Ray. The one thing that seems to be different is that, as soon as another argument comes in that requires a path, the "system" function call no longer works properly as it's truncating the path, whether or not quotes are present. For example. This works just fine:
When I get to that line with the "system" function call and execute it, I see POV-Ray starting up. POV-Ray errors, of course, mentioning of no input file but I'm expecting that. If I add an input file like this:Code:sprintf(ExecutionString, "\"C:\\Program Files\\POV-Ray\\v3.7\\bin\\pvengine64.exe\"" " +W%1d +H%1d +UA +FN8 -A", ImageSize, ImageSize); system(ExecutionString); // executes the above
I see that the original path has been truncated to only "C:\Program" instead. When I execute the that line with the "system" function, I see this error:Code:sprintf(ExecutionString, "\"C:\\Program Files\\POV-Ray\\v3.7\\bin\\pvengine64.exe\"" " +I\"%s%spov\" +W%1d +H%1d +UA +FN8 -A +O\"%s%spng\"", FileNameBase, SpeciesName, ImageSize, ImageSize); system(ExecutionString); // executes the above
'C:\Program' is not recognized as an internal or external command, operable program or batch file
POV-Ray does not execute because the path is being cut off. Java's path is not being cut off... unless I use the one in the program files directory where it does end up getting cut off. Surely there's something weird going on with the system function that's causing file paths to not execute correctly. This issue has been being fought for over 6 hours now and it's preventing me from finishing up this task. What's going on here?
Edit: I'm using MSVC 2008 Express under Windows 7 Pro SP1 (fully updated).