Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r368:b153965be6e6
Date: 2012-06-15 16:44 +0200
http://bitbucket.org/cffi/cffi/changeset/b153965be6e6/

Log:    Update the example: the buffer is read-write.

diff --git a/doc/source/index.rst b/doc/source/index.rst
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -120,9 +120,14 @@
         } pixel_t;
     """)
     image = ffi.new("pixel_t[]", 800*600)
-    image[0].r = 255
-    image[0].g = 192
-    image[0].b = 128
+
+    f = open('data', 'rb')
+    f.readinto(ffi.buffer(image))
+    f.close()
+
+    image[100].r = 255
+    image[100].g = 192
+    image[100].b = 128
 
     f = open('data', 'wb')
     f.write(ffi.buffer(image))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to