S
subaruwrx88011
I am new to c++. Here is my problem. When my application runs it
creates a log file for that day containing application specific
information. The file format is CCSI_2006_51.log with 2006 being the
year and 51 being the days since Jan 1st. If we run this application
again on the same day it will append to the file already created
earlier. Though this application might not run everyday. So we could
have CCSI_2006_48.log and then CCSI_2006_51.log. I need to keep all log
files from 40 days ago to the present. There could be a total of 40 log
files if the application was indeed ran everyday for 40 day. Anything
created before 40 days ago has to be deleted.
Im think of the approach of a loop that checks the creation date of all
files ending in .log in a given directory and then deleting those that
have a date before presentDay minus 40. I have no idea how to do this
in c++ and my reference book doesn't have anything about this. I know
how to delete a file using the remove() method but how do I go through
every file ending in .log in a directory in c++ and how do I get the
creation date from the file into c++? Oh, the platform is linux.
Any help would be greatly appreciated.
Thanks in advance
creates a log file for that day containing application specific
information. The file format is CCSI_2006_51.log with 2006 being the
year and 51 being the days since Jan 1st. If we run this application
again on the same day it will append to the file already created
earlier. Though this application might not run everyday. So we could
have CCSI_2006_48.log and then CCSI_2006_51.log. I need to keep all log
files from 40 days ago to the present. There could be a total of 40 log
files if the application was indeed ran everyday for 40 day. Anything
created before 40 days ago has to be deleted.
Im think of the approach of a loop that checks the creation date of all
files ending in .log in a given directory and then deleting those that
have a date before presentDay minus 40. I have no idea how to do this
in c++ and my reference book doesn't have anything about this. I know
how to delete a file using the remove() method but how do I go through
every file ending in .log in a directory in c++ and how do I get the
creation date from the file into c++? Oh, the platform is linux.
Any help would be greatly appreciated.
Thanks in advance