I am writing a pretty basic program for personal use, but I really want to make sure that I use good practices, especially if I decide to make it more reliable later or something like that.
In all senses and purposes, the program takes some input files as arguments, opens them with the help fopen(), reads from files, makes material with this information, and then saves the output as several different files in a subfolder. for example, if the program is in ~/program, then the output files are saved in~/program/csv/
I am just outputting directly to files, for example output = fopen("./csv/output.csv", "w");, printing it with a fprintf(output,"%f,%f", data1, data2);loop, and then closing with fclose(output);, and I just feel that this is bad practice.
Do I have to save it in the temp directory and it is written and then moved when it ends? Should I use more complex file I / O libraries? Did I just completely rethink this?
source
share