Question:

How would you save multiple array list to a text file with it deleting the first save?

by  |  earlier

0 LIKES UnLike

i was trying to save multiple array entries but when i tried to save the second time from an array list, it deletes the first entry

 Tags:

   Report

1 ANSWERS


  1. You don't specify which programming language you are using but the best solution would be to check that when you are open your sequential (text) file for Output for the second and subsequent outputs that you are using the Append method rather than Output. This will add any extra data onto the end of the file instead of replacing it.

    If your language/IDE doesn't support Appending to sequential fies then you would need to read the contents of the file into memory (or a temporary array) and then write it and any new information back out into the file. The second method will be much slower and use more memory, so go with Append if you can.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.