Shell execute... but piping

This is a discussion on Shell execute... but piping within the C++ Programming forums, part of the General Programming Boards category; Howdy everyone, I am currently writing my own web server in C++, and it's all been going swimmingly so far. ...

  1. #1
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986

    Shell execute... but piping

    Howdy everyone,
    I am currently writing my own web server in C++, and it's all been going swimmingly so far. It can take requests and send out files based on the MIME types (I think).

    The next thing I want to do is get it to be able to run scripts in langauges like PHP, Perl and python etc. What I need to be able to do is call an executable, with the filename it needs to run.

    I figure I can just do this with a function like shellexecute, but I dont want it to show on up on my screen. I need a function like shell execute but that will start whatever program i call and NOT show its output, but will store it in a string or pipe it directly to my program....

    Any ideas would be most helpful Thanks!

    ~ Paul

  2. #2
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Thanks very much! That worked perfectly!

  3. #3
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Actually, I'm having a slight problem. This is what I have:
    PHP Code:
    FILE handle _popen("D:\\Program Files\\PHP\\php-4.3.1-Win32\\PHP.EXE H:\\paul.php""rt"); 
    The only problem with it is that Program Files is two words and so obviousley its trying to run D:\Program with the rest as arguments.

    I know I could go through and chop it up heaps and replace it with ~1's, but is there an easier way? For example, could I replace the spaces with a character or something (I don't do a lot of console stuff), or, is there another function similar that will work in the same way bit with long filenames?

    Any help is once again appreciated

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 34
    Last Post: 05-27-2009, 01:26 PM
  2. Program to execute shell commands.
    By LiquidLithium in forum C++ Programming
    Replies: 6
    Last Post: 09-01-2004, 01:22 PM
  3. What shell is more powerful?
    By xddxogm3 in forum Tech Board
    Replies: 10
    Last Post: 07-24-2004, 11:47 PM
  4. programming unix shell piping problem
    By Kyro in forum Linux Programming
    Replies: 2
    Last Post: 08-28-2003, 08:52 AM
  5. Problems with Shell Execute
    By golfinguy4 in forum Windows Programming
    Replies: 3
    Last Post: 12-03-2002, 12:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21