//No, I don't write in a file ... I just read from a file.If the state is changed it is set in the struct object.
But... if you have 100 records and 100 doors, how are you telling the doors their states?
Imho, you need OR load state of the door in every action of door (read all file and search needed state), OR store all records in operative memory, and spread doors/states from here