Loading a char array in a GInputStream variable

Hi, I have a char array containing a PDF. I need to load it into a GInputStream variable.

From what I understand, I need to load it in a GOutputStream first through g_output_stream_write, then use g_output_stream_splice to copy it to a GInputStream variable.

However, g_output_stream_write always fails. I guess I am mistaking the way to do it. Could somebody point me out to the correct way?
Is there a way to load a char array into a GInputStream?

Do you want to have your PDF accessible as a GInputStream? Then you can just wrap it into a GMemoryInputStream

I think I did a test with g_memory_input_stream_add_data, but it didn’t work as well. I will try again. If you would happen to have any examples…

Well. I usually use it with g_memory_input_stream_new_from_data / _from_bytes. Depends what exactly went wrong for you, I suppose?

Thank you, I finally got it working with g_memory_input_stream_add_data!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.