execl question
In a terminal I can issue the command:
Code:
mplayer file.mp3 > mplayer.output in my c++ program I try something similar: Code:
execl("/usr/bin","mplayer","-slave","-idle",">","mplayer.output",NULL); |
It doesn't work because it's the shell (typically bash) which interprets the ">" and sets things up right. With your execl() call, no such interpretation is done; each part of the command line is sent directly to your program, including the ">" and the "mplayer.output".
Speaking of "your program", what is your program? It looks from the execl() call that you're trying to execute "/usr/bin". Your first parameter should be (presumably) "/usr/bin/mplayer"; your second parameter should remain "mplayer", as it is now. The easiest way out of this is the following C/C++ code: Code:
#include <stdlib.h> Code:
man execl |
I wish I could use a system() call in my program. My program is basically a mplayer front-end for use in car PCs. I create a pipe and fork() before I call my execl() so my program can control mplayer via a stdin pipe. The problem has been that I can't seem to create a stdout pipe that works.
I figure I can best access mplayer's output, if it where a file. Any ideas? |
I haven't done anything with this, ever, but play around with this on a PC and see if it works for you.
Code:
int fork_result; Hope this helps. |
All times are GMT -5. The time now is 12:06 AM. |