I've got a loop that goes through an array and appends the elements to a file and adds a field onto the end of the line to denote what type the element is.
However should I open the file before the loop and then close it after the loop or open and close it on each iteration?
Speed isn't that crucial since the loop waits on user input before moving on.
Would opening and closing it on each iteration make the data safer if the program was to crash or be closed in the middle of execution?
Bookmarks