Re: [Vala] Downloading a file from the internet to some directory.



Thank you very much ,Frederik.

On Sun, Sep 27, 2009 at 9:43 AM, Frederik <scumm_fredo gmx net> wrote:

Arkadi Viner wrote:
Hello every body.

My program needs to download some file from the internet each time it
starts,
how to accomplish that mission?

Is there a gtk librery to do it or i have to use the webkit library?

Thanks.

Hi,

--------------------------------------------------------------------
void main () {
       var src = File.new_for_uri ("
http://download.gnome.org/sources/vala/0.7/vala-0.7.6.tar.bz2";);
       var dst = File.new_for_path ("vala-0.7.6.tar.bz2");
       try {
               src.copy (dst, FileCopyFlags.NONE, null, null);
       } catch (Error e) {
               stderr.printf ("%s\n", e.message);
       }
}

--------------------------------------------------------------------
$ valac download.vala --pkg gio-2.0

Alternatively use 'copy_async()' for asynchronous copying.


Best regards,

Frederik
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list



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