mpg123 is an MP3 player for Linux. It has a stdin interface, whereby if I launch mpg123 by typing:
mpg123 -R asong.mp3
I can then make requests to mpg123 via the stdin like:
LOAD asong.mp3
LOAD anothersong.mp3
PAUSE
I have got this much working, but I want to make a C Program that can do this. I tried writing a program that prints to stdout using printf, and then re-directeding the output of that to the input of mpg123, but for some reason it does not work:
Ok, I see what your doing as I've just looked up that function.
But is it possible for my program that spawned the mpg123 process to communicate to mpg123's STDIN? Is there a way of re-directing the std i/o so I can do this?
I don't have any experiance with programming for linux, nor have I ever done this in windows. But the way I would go about this, is getting the handle to the program (mgp123)
and then redirect the standard input to that program. In windows, I think the function SetStdHandle can do this. Don't know about linux.
if linux doesn't work with handles, then I have no idea how you can identify the mgp123 program.
-- Maes
__________________
If you don't succeed at first, redefine succes