This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Update record

Hi There,

Can I update the record only by adding content based on the former record?

Best,

Gaosheng

Parents Reply
  • Hi Terje,

    Thank you for your reply. In FDS, I can find the operations about deleting, adding, updating, and queries. About the updating, it says it only delete the former then update the new one. I am not sure if the former info exists.

    Best,

    Gaosheng 

Children
  • Hi,

    In order to use fds_record_update(), you need a record descriptor to tell FDS which record you want to update. This means you do need to search for the existing record, for instance through use of fds_record_find(). If you do not find an existing record, you should use fds_record_write() instead.

    See for instance how this is done for the Flash Data Storage Example. There you will find relevant code in the function record_update() in the file cli.c. There is also use of fds_record_find() in the main() funciton of main.c, where the record is read, modified and updated (if it exists) or written (if it does not exist, in the else branch.)

    Regards,
    Terje

Related