jwhiddon / EDB

A re-implementation of the Arduino database library to allow more than 256 records
GNU Lesser General Public License v2.1
89 stars 43 forks source link

May I partially update Struct? #22

Open SerhioRed opened 7 years ago

SerhioRed commented 7 years ago

For example

struct BlackList { char sessioncard_dbb[10]; int id_local; int cardblocked; } blackList;

and i want to update just cardblocked.

blackList.cardblocked = cardchangeto1;
EDB_Status result = db1.updateRec(numbc1, EDB_REC blackList);

But after that the rest of struct becomes zeroes.

I need to read the struct to variables and update in whole?

thanks!

DedeHai commented 7 years ago

you probably can, all the library does is write the struct to eeprom memory BUT it always writes the whole struct. to partially update, read the struct contents from eeprom, change it, write it back.