Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r409:c65dc7d34f2c
Date: 2012-06-17 16:38 +0200
http://bitbucket.org/cffi/cffi/changeset/c65dc7d34f2c/

Log:    Note that the buffer only works to read/write in files opened in
        binary mode.

diff --git a/doc/source/index.rst b/doc/source/index.rst
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -123,7 +123,7 @@
     """)
     image = ffi.new("pixel_t[]", 800*600)
 
-    f = open('data', 'rb')
+    f = open('data', 'rb')     # binary mode -- important
     f.readinto(ffi.buffer(image))
     f.close()
 
@@ -516,7 +516,7 @@
 the array.  Getting a buffer is useful because you can read from it
 without an extra copy, or write into it to change the original value;
 you can use for example ``file.write()`` and ``file.readinto()`` with
-such a buffer.
+such a buffer (for files opened in binary mode).
 
 ``ffi.typeof("C type" or cdata object)``: return an object of type
 ``<ctype>`` corresponding to the parsed string, or to the C type of the
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to