Hello,

Faced the problem of writing data to the logs. Each new data transmitted via a socket must be written into a separate file with a new name (log1.txt, log2.txt ....)

There is an idea that you need to check the directory for files, read the name into a string and add a digit. Can anyone have any advice?

    1 answer 1

    Are the file names (log1.txt, log2.txt ...) important? If not, then in my opinion the easiest way to name log files is by the creation date (something like YYYYMMDD-HHMMSS.txt). But again, if not more than once a second files are written

    • Thank you very much. I didn’t immediately think that the date could be recorded - Shihkauskas