Using pipes running apps
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Using pipes running apps

  1. #1
    Join Date
    Oct 2009

    Unhappy Using pipes running apps


    I am trying to run a command line program (in windows), so I use the following code:

    FILE *cmd_pipe;
    cmd_pipe = popen ("WaveRecorder.exe temp.wav", "r");
    pclose (cmd_pipe);
    Now, I have a problem, my WaveRecorder stops when I press Enter key.

    Is there a way to simulate "Enter" into the pipe? Is it possible to write more than one command into the pipe?

  2. #2
    Join Date
    Nov 2007
    Birmingham, England

    Re: Using pipes running apps

    Command line programs which wait for the enter key are just waiting for the newline charicter "\n". You should be able to simply write that charicter to the pipe.
    fputc('\n', cmd_pipe);
    Notice the single quotes here not double quotes.

    Hope this helps
    Please use: [ code ][/ code ] tags and reasonably correct tabbing. They really help us read your code
    End Signature

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center