Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+31 votes

I've looked at the json/gson methods that Stonedahl provided. I can use those to write code where a .txt file is altered when an AnimalTrack is updated. I can only do this for a file that I import into Eclipse though. I want the final software version to create a new file for output each time the program gets run instead of altering the same file each time. Does anyone have advice for how I can do that? I also want the output file to be stored in a location of the user's choice.

asked in CSC285_Fall2018 by (491 points)

1 Answer

+17 votes

First, have you looked at the couple of questions on the Q&A already about exporting?

See: http://lovelace.augustana.edu/q2a/index.php/tag/export

A few other pointers:

1) Your file name should end with ".csv" instead of ".txt", but yes it is plain text on the inside.

2) Export to CSV is a totally separate operation from the load/save project (using JSON). You'll want to make your own method inside the ProjectData class to handle exporting to the CSV file.

answered by (3.5k points)