From: Francesc A. <fa...@ca...> - 2006-10-17 16:36:13
|
A Dimarts 17 Octubre 2006 18:22, Travis Oliphant va escriure: > >2.- Fetch the buffer in scalartype.data and use the buffer protocol in > > order to access the pointer to data in memory. However, I lack experien= ce > > in buffer protocol, so suggestions for achieving this are welcome. > > This will also work. A read-only buffer protocol is exported by all > the scalars. > > scalar.data will return a buffer object. > > Or you can use the Python C-API > > const char *buffer; > Py_ssize_t buflen; > > PyObject_AsReadBuffer(scalar, (const void **)&buffer, &buflen) Oh, this one seems pretty easy, and as a plus, you don't have to book memor= y=20 for copying the data area, so I'll use it. Thanks, =2D-=20 >0,0< Francesc Altet =A0 =A0 http://www.carabos.com/ V V C=E1rabos Coop. V. =A0=A0Enjoy Data "-" |