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

Thread: Using pipes running apps

  1. #1
    Join Date
    Oct 2009
    Posts
    3

    Unhappy Using pipes running apps

    Hi,

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

    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
    Location
    Birmingham, England
    Posts
    157

    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.
    Code:
    fputc('\n', cmd_pipe);
    Notice the single quotes here not double quotes.

    Hope this helps
    Signature
    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 CodeGuru survey question.


Featured


HTML5 Development Center