Re: [Vala] patch to add read/write to FileStream



In the definition use a default parameter:

..., int nmemb = 1)...

Which means if the caller code doesn't supply a value then vala fills in a 1.

sam



-----Original Message-----
From: Cliff Brake <cliff brake gmail com>
Sent: 04 September 2008 23:14
To: vala-list gnome org
Subject: [Vala] patch to add read/write to FileStream

The below patch adds read/write to FileStream:

Index: vala-0.3.5/vapi/glib-2.0.vapi
===================================================================
--- vala-0.3.5.orig/vapi/glib-2.0.vapi  2008-08-29 17:39:43.000000000 -0400
+++ vala-0.3.5/vapi/glib-2.0.vapi       2008-09-04 17:05:11.000000000 -0400
@@ -2426,6 +2426,10 @@
                public int scanf (string format, ...);
                [CCode (cname = "fflush")]
                public int flush ();
+               [CCode (cname = "fread", instance_pos = -1)]
+               public int read (char[] buf, int nmemb);
+               [CCode (cname = "fwrite", instance_pos = -1)]
+               public int write (char[] buf, int nmemb);
        }

        [CCode (lower_case_cprefix = "g_file_", cheader_filename =
"glib/gstdio.h")]


Question:  is there any way I can always set nmemb=1 so the caller
does not have to set that variable?  In vala, I would just do:

read(buf), instead of read(buf, 1)


Thanks,
Cliff

-- 
=======================
Cliff Brake
http://bec-systems.com
_______________________________________________
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]