Re: Converting clib FILE stream in GFileInputStream

On 11/10/2009 06:32 PM, Martin Kalbfuß wrote:

Wouldn't that be platform specific? I'm new to the GTK+ world so I'm
still confused about which file to use. Currently that's even not that
important, because the other library I use has it's own stream type like
GIO has and it hasn't the ability to convert it to a standard file
stream. So mixing the two APIs isn't possible. What a shame.

Sure you can. Just create a GMemoryInputStream or GMemoryOutputStream depending on the direction of the data flow between the two APIs.

If using GMemoryInputStream, in the write callback from your other API, you call g_memory_input_stream_add_data() (perhaps on a copy of the data).

If using GMemoryOutputStream, humm, seems like the API doesn't provide a callback for this one.

Regardless, you can definitely subclass GInputStream / GOutputStream yourself to achieve what you want.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]