-
Notifications
You must be signed in to change notification settings - Fork 7.6k
How do I save and read array values with preferences? #2497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you just want to save and load the whole array, you can simply putbytes("myArray", &myArray, sizeof(myArray)); |
This will require the the modification I just submitted, but shows how to cast data into a struct array.
|
Thank you all. I think I have it figured out now! |
Please close the issue |
My apologies. It is closed now. |
How that would look like for an array of Booleans? Because if I have an array of 10 items, that would make the second byte to be all messed up. |
@guilhermeaiolfi booleans are stored as complete bytes (chars or unsigned chars, idk exactly). If you need to store hundreds of booleans, you could squish them down to bits but otherwise I'd say just store the whole bytes. |
I would like to understand how to use this library to write arrays to the memory and to read them.
I am using this library with a Heltec WifiKit 32.
I found this thread, however, I am still struggling to understand.
#611
Thanks,
xman4242
The text was updated successfully, but these errors were encountered: