Out of range exception when adding new values to C-style arrays #4256
Unanswered
NotpainRaov
asked this question in
Q&A
Replies: 1 comment 2 replies
-
You will have to do the extraction from JSON manually in the object containing the array, rather than using any of the predefined functions that read the array based on the current size of the array. If you share your current code, we may be able to help you with that. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone. I am having issues with parsing C-style arrays using the library. When adding a new element to the array, then trying to read data from a file which was last updated before the new value was added to the array (so the data we read and parse has less values than expected), this exception gets thrown:
The array (saved as a json list) in the file on disk contains 5 values, but after modifying the array in the code, it's supposed to have 6.
Here is the example code used:
And that part of the file on disk looks like this:
Are there any workarounds for this? Switching the raw array to an std::vector works, but I would prefer not doing so if it's not necessary.
Beta Was this translation helpful? Give feedback.
All reactions