[fpc-pascal] File Descriptor in Windows ?

Andrew Haines andrewd207 at aol.com
Wed Mar 25 17:59:19 CET 2015


On 03/25/2015 08:23 AM, fredvs wrote:
> Hello.
>
> Sorry to sorry to bother you with that file descriptors again... ;-(
>
> There are some answers there on mpg123 forum.
> They explain that "simple stdin/stdout file descriptors would work."
> Of course all what they explained is in C ;-(
>
> OK, but how can i use "simple stdin/stdout file descriptors" in Pascal ?
> What is the code to retrieve that stdin/stdout file descriptors in Windows?
>
> Many thanks.
>
> Fre;D
>
>
>

I've been thinking that for your purposes you could use
mpg123_replace_reader_handle
http://www.mpg123.de/api/group__mpg123__lowio.shtml#ga61a125c56f2aab9590a4b1a29194dc10

and
mpg123_open_handle
http://www.mpg123.de/api/group__mpg123__input.shtml#gaadda450ea307f88589cb77ffda0754ab

Then you could do
mpg123_open_handle(mpg, Output); //Output is a TStream descendant

and the functions you supply with mpg123_replace_reader_handle can just 
read directly from the TStream. Then you don't have to rely on anything 
on each OS other than some TStream descendant can read the file you want 
to play.

Andrew

PS I noticed these functions don't exist yet in your mpg123 bindings.
<http://www.mpg123.de/api/group__mpg123__input.shtml#gaadda450ea307f88589cb77ffda0754ab> 




More information about the fpc-pascal mailing list