How can I determine the used size/length of a buffer created with create_string_buffer?
buffer = create_string_buffer(1000)
e.g. in buffer I have 3 values and 997 unused -> how it's possible to get the 3?
Is there any reason you can't just do len(buffer.value)?
For pure theoretical fun of it -- I see no reason to do this if you can use the above method -- I'll mention that you can also do buffer.raw.find("\x00") or list(buffer).index("\x00"). These fail if the string is not properly null-terminated though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With