Can anyone please help on how to create log file in Visual C++ using MFC????
cb02061
0
Newbie Poster
Recommended Answers
Jump to Postlog files are just simple text files. I usually put the date/time at the beginning of the log entry. I wouldn't bother with any of the MFC file functions such as CFile and CArchive. Use normal fstream objects. The log function should open the log file, write the log entry …
Jump to PostThis has not been compiled or tested, so it might or might not contain bugs.
void log(const char*msg) { time_t now = time(0); struct tm* tm = localtime(&now); ofstream out( "logfile.txt",ios::ate); out << tm->tm_year << '/' << tm->tm_mon << '/' << tm->tm_mday << ' ' << tm->tm_hour …
All 7 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
cb02061
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
cb02061
0
Newbie Poster
cb02061
0
Newbie Poster
Laiq Ahmed
42
Junior Poster
Necrolis
-2
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.