Recover chained list of.bin file

Asked

Viewed 55 times

1

I am programming in C and I have a code that uses a sequential list of 50 positions to store in each of its spaces the first address of several chained lists, so far so good, the problem is when I fill the list and write in a.bin file, because at the time of performing the recovery of the data from the file to the software, with only the contents of the sequential lists already that of the chained lists are lost, I believe it is because at the time when I do the recovery of the data, the old addresses that were occupied by the chained lists are no longer available in the same sequence they were in at the time I recorded the file, someone could confirm me if this is really the problem and if there is any solution?

  • How you serialized the list chained into the file?

  • I did it using fwrite() as follows: fwrite(list, sizeof(struct), 1, Fp);

  • I think you ended up editing and missing the previous comment. I remember seeing a fwrite past the structure and the size of it. This will cause information loss and impossibility to reassemble the structure again. You need to serialize without losing information

  • In case fwrite should not be used()?

  • It should be with fwrite, but not naively.

  • In this case the problem would be solved manually through some method of adding information that would be archived along with the data in the.bin file?

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.