I have a finite array list of a data structure (some char and integers). I can write to a file with the update of the array list. For example, let say the array list holds an array of five data structures. I can write all contents to a file.
While the program can update a file with the latest content, it cannot *read* all data from the file. For example, let say the array list holds five data structures. Let say the array list was full when the program updated the database file. Thus, there are five complete data structures in the database file. When the program reads the database file and copy the data from the file into the same array list, it only reads *the first data structure*. In other words, the program can update the database file with new data structure, but it can only read one data structure from the file at any instances.
Here is how I get it to read data from the database file.
file.read(reinterpret_cast<char *>(instanceofarraylist), sizeofdatabasefile);
What is the best way to solve this problem? I want to copy all context from the database file into the array list.
Last, is this problem related to the fact that the list is an array rather than pointer-base?