Thread: System function problems - add paths, executable truncated

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Math wizard
    Join Date
    Dec 2006
    Location
    USA
    Posts
    582

    System function problems - add paths, executable truncated

    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.

    http://platformmasters.com/images/Pl...eenshot544.png

    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:

    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
    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\""
            " +I\"%s%spov\" +W%1d +H%1d +UA +FN8 -A +O\"%s%spng\"", 
            FileNameBase, SpeciesName, 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:

    '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).
    Last edited by Salem; 06-29-2014 at 01:20 AM. Reason: folded long lines
    High elevation is the best elevation. The higher, the better the view!
    My computer: XP Pro SP3, 3.4 GHz i7-2600K CPU (OC'd to 4 GHz), 4 GB DDR3 RAM, X-Fi Platinum sound, GeForce 460, 1920x1440 resolution, 1250 GB HDD space, Visual C++ 2008 Express

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problems with inventory system
    By a29bbas in forum C Programming
    Replies: 2
    Last Post: 01-07-2014, 11:50 AM
  2. Student GPA system problems
    By ShiroiShu in forum C Programming
    Replies: 10
    Last Post: 11-28-2011, 10:55 AM
  3. Copying system files problems
    By Dark Nemesis in forum Tech Board
    Replies: 11
    Last Post: 03-24-2004, 01:06 AM
  4. System problems
    By JLBSchreck in forum Tech Board
    Replies: 4
    Last Post: 06-06-2003, 08:46 PM
  5. System.ini Shell Problems
    By (TNT) in forum Windows Programming
    Replies: 2
    Last Post: 08-26-2001, 01:05 PM

Tags for this Thread