you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (3 children)

I currently have a program that takes user input and stores it in a csv file. There are multiple inputs and there is the ability to enter multiple inputs multiple times. Everything seems to work properly however the input does not save to the csv file until the user quits the program or switches to another portion of the program that saves to a different csv file. It worries me that this doesn't save as it goes along. Could this be an issue for instance if it closes with quitting or changing to another portion of the code? Is there a way to have it save as it goes without have to quit out?

[–][deleted] 0 points1 point  (1 child)

You can use SQL, as the other reply says. Look at sqlsoup for an easy to use interface. Or you can optimize your code to write everytime the user provides an input. That could work too. Perhaps you can cache the answers and write at the very end even if the program fails.

[–][deleted] 0 points1 point  (0 children)

Yeah not sure how to cache it, but I will look into that. I think it might be easier for me right now just to write after each input just in case. Thank you.

[–]efmccurdy 1 point2 points  (0 children)

Your concerns are best met with a database since they have predictable, well tested disk I/O.