From: Hans Müller on 19 Mar 2010 14:46 Hello, I need some buffers, which are beeing concatenated an then send via the socket() function. My problem is that create_string_buffer() creates a buffer which ist one byte too long (for a \0 char). But when I concatenate some of these buffers to a long one to be transfered, the extra byte is corrupting the resulting buffer. Of course I could slice the buffer before being concatended, but this looks ugly to me. Is there a way to create a writeable buffer object without the \0 byte ? Thanks a lot Hans
From: Emile van Sebille on 19 Mar 2010 16:33 On 3/19/2010 11:46 AM Hans M�ller said... > Hello, > > I need some buffers, which are beeing concatenated an then send via the > socket() function. > My problem is that create_string_buffer() creates a buffer which ist one > byte too long (for a \0 char). But when I concatenate some of these > buffers to a long one to be transfered, the extra byte is corrupting the > resulting buffer. > Of course I could slice the buffer before being concatended, but > this looks ugly to me. > Is there a way to create a writeable buffer object without the \0 byte ? > > Thanks a lot > > Hans >>> p = create_string_buffer(5) >>> p.raw='hello' >>> p.value 'hello'
|
Pages: 1 Prev: What is pkg-config for ? Next: script to upload file using POST form |