Re: [mpg123-devel] Code example of mpg123_index and mpg123_set_index
Brought to you by:
sobukus
From: Sven B. <s.b...@gm...> - 2018-09-27 17:21:00
|
Hello, so just a more question: You said " Of course, when re-reading the index for handing it to mpg123_set_index(), you need to allocate fill elements of the correct type and then store the values there." What do you mean by re-reading the index? I thought mpg123_index() wants a pointer to an array and tells after the call, how much the array has been filled, or am I missunderstanding something? Maybe a code example would be nice, of how to retreave the index and hand it to another handle ;). Thanks for your answers Sven Mit freundlichen Grüßen Sven Baus 0175/49 50 309 -----Ursprüngliche Nachricht----- Von: Thomas Orgis [mailto:tho...@or...] Gesendet: Dienstag, 25. September 2018 12:57 An: mpg...@li... Cc: s.baus86 Betreff: Re: [mpg123-devel] Code example of mpg123_index and mpg123_set_index Am Tue, 25 Sep 2018 11:30:18 +0200 schrieb "s.baus86" <s.b...@gm...>: > Thanks for your mail. How should the array be initialised? The argument to mpg123_index() is just a pointer without associated memory. You get the size of the associated memory via fill. Of course, when re-reading the index for handing it to mpg123_set_index(), you need to allocate fill elements of the correct type and then store the values there. > Sorry for asking, but I'm not that familiar with C. You need some understanding of C with pointers and data types. If in doubt, try to read a bit more, the net is ripe with tutorials and examples. > int[] indexArray = new int[100]?! Or is it that simple? If 100 is the number of elements, not some arbitrary fixed value, this sounds about right for C++ (I'd write int* instead of int[]) except for the fact that int is not the correct type. It is off_t. That an be identical to int, but mostly will not be. Alrighty then, Thomas |