Hi there.
The question is how can I get the size in bytes of text buffer to save it later in the file?
I searched for appropriate function in docs but didn’t find exactly what I need.
I can get offset of last char with
Since you’re already saving the buffer contents, you’re already getting the text. The length in bytes is not really useful for anything except for storing the buffer data into some bytes buffer, like a file.
On the other hand, the length in characters is a bit more complicated to retrieve, especially if we don’t want to expose the internals of the text buffer object, which warrants the presence of a specialised getter function.