MaxG:
However...
When the day changes, it creates an error once only.-> Writing data to log file: 20170701.CSV
-> Error opening: 20170702.CSV
-> Writing data to log file: 20170702.CSV
The docu says that if the file does not exist it will be created. How can I avoid this error?
char filename[13];
allocates 13 bytes in RAM. 20170702.CSV/0 is more than 13 characters long, it is actually 14.
You have to count the trailing null so your variable declaration should be at least:
char filename[14];
When you did your strcat() operations, it kept pushing the null (/0) to the right, it messed up something when it moved outside of its defined storage space.
Chuck.