i have a online logging of data through com port.
the c program captures the online data every 1 minute, calculates ten minute average, standard deviation and then writes it to a file.
the file is created with getdate function.
when the day changes, i have to create the new file with the new date which is not happening. can someone help.
i can send the code if interested.


The way I did it was create a new filename every time I wanted to open the file. That way when the date changes my algorithm will automatically pick up the new date.

time_t now = time(0);
struct tm* tm = localtime(&now);
char filename[255];
    tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
// now open the file