summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md10
1 files changed, 8 insertions, 2 deletions
diff --git a/README.md b/README.md
index 1bec0ca..09046b2 100644
--- a/README.md
+++ b/README.md
@@ -137,7 +137,13 @@ ecbor_item_t item = ecbor_stop_code ();
but the user must subsequently encode the correct amount of child items (for definite-size arrays and maps) or the stop code (for indefinite arrays and maps).
-Once all the items have been encoded, the length of the output buffer can be obtained from `BUFFER_SIZE - context.bytes_left`.
+Once all the items have been encoded, the length of the output buffer can be obtained either by calling
+```c
+size_t sz;
+ecbor_error_t rc = ecbor_get_encoded_buffer_size(&context, &sz);
+```
+
+or by using the `ECBOR_GET_ENCODED_BUFFER_SIZE` macro.
### Decoder
@@ -362,4 +368,4 @@ And finally, in order to retrieve the length of arrays, maps, strings:
```c
ecbor_item_t item;
size_t len = ECBOR_GET_LENGTH(&item)
-``` \ No newline at end of file
+```