i have vlc (program to reproduce videos) if i type in a shell:
/home/vlc "/home/my movies/the movie i want to see.mkv"
it opens up an reproduces the movie.
however, when I run the following program:
#include <unistd.h>
int main(void) {
execl("/home/vlc", "/home/my movies/the movie i want to see.mkv",NULL);
return 0;
}
vlc opens up but doesn't reproduce anything. How can I solve this?
Things I tried:
I guessed
execl("/home/vlc", "/home/my movies/the movie i want to see.mkv",NULL);
was equivalent to typing in the shell:
/home/vlc /home/my movies/the movie i want to see.mkv
which doesn't work, so i tried
execl("/home/vlc", "\"/home/my movies/the movie i want to see.mkv\"",NULL);
and vlc opens up but doesn't reproduce either.
Instead of writing NULL at the end I tried 0, (char*) 0, 1 .... not helpful. Help!!!!
errno
after the failed execl? It would have told you more about your problem. What has become of reading the man page for execl carefully? :-) – Rotz