Hi,
I want to create a log file that captures all the actions happening...anyway i got code for that from internet.
Now what i want to do is, make that file read only so that the data is not modified by external application or user.
Code:log(char* msg) { time_t now = time(0); struct tm* tm = localtime(&now); ofstream out( "logfileBrandNew.log",ios::app); out << tm->tm_year << '/' << tm->tm_mon << '/' << tm->tm_mday << ' ' << tm->tm_hour << ':' << tm->tm_min << ':' << tm->tm_sec << ": "; out << msg << "\n"; out.close(); }




Reply With Quote
