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>
int result;
result=system("mplayer file.mp3 > mplayer.output");
if(result!=0)
{
/* Do error handling here. */
}
For more information:
Code:
man execl
man system
Hope this helps.