JM píše v Út 09. 02. 2010 v 10:36 +0100:
> Hi all 
> 
> I have a little problem on working with buffer offsets in vala.
> In C doing an offset for a "char buf[SOME_SIZE];" is easy, but I have
> difficulties doing it in vala.
> 

You can simply use the same way you would in C. Cast your buffer to a
pointer and do pointer arithmetic with it.

Simple example:

void main ()
{
        char[] testbuffer = new char [8] { 0, 1, 2, 3, 4, 5, 6, 7 };
        char* testbufferoffset = ((char*)testbuffer) + 5;
        assert (testbufferoffset[0] == 5);
        testbufferoffset[1] = 25;
        assert (testbuffer[6] == 25);
}

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to