I have a program which will run on a cron job and write the output to a CSV file.
I get it to write correctly but I would like to make the program write headers on the first row when the file is created. Is there a way of the program checking if there are any rows in the CSV file and, if not, writing the headers.