Re: [Vala] Vala 0.11.6 How do I copy a file using GInputStream and GOutputStream?
- From: Frederik <scumm_fredo gmx net>
- To: vala-list gnome org
- Subject: Re: [Vala] Vala 0.11.6 How do I copy a file using GInputStream and GOutputStream?
- Date: Tue, 01 Mar 2011 23:51:49 +0100
On 03/01/2011 07:21 PM, Graham Whelan wrote:
Hi,
I'm trying to copy a file using GLib.InputStream and GLib.OutputStream
but the copied file ends up corrupted.
Sample code:
uint8 buffer[4096];
size_t read;
while (true) {
read = input.read (buffer);
if (read > 0) {
output.write (buffer);
} else {
break;
}
}
Do you know the splice() method? It pumps data from an input stream to
an output stream:
output.splice (input, 0);
Best regards,
Frederik
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]