[Vala] reading and writing binary data



Hello,
I am using GNet to read data from a file over http and then write the
data to a local file. Everything works fine when I am reading a text
file but when I read some sort of binary file the data gets corrupted.

I believe the problem is caused by Vala converting the data
that I read into a UTF8 string. One way to fix this problem is to read
the data as a GLib.ByteArray but I couldn't find a way to iterate over
ByteArray and extract a single byte. It may also be possible to pull
the raw string data from the Vala string. Unfortunately I don't know
how to do this. Any advice regarding reading and writing binary data
would be greatly appreciated.

jezra



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