title: Reading contents of buffer line by line
body: <p>I have to parse contents of printfbuf line by line, how can I do it?
  I tried the following code but it prints one character per one line:</p>
  
  <pre><code>import StringIO
  import ctypes
  
  printbuffer = ctypes.create_string_buffer(100000)
  print_buff = ctypes.c_char_p(ctypes.addressof(printbuffer))
  
  buf = StringIO.StringIO(print_buff)
  for x in buf.readline():
      print(x)
  </code></pre>