A simple program that displays the current date and time to the console:

#include <iostream> #include <ctime> int main(void) { time_t tt = time(NULL); #pragma warning ( disable : 4996 ) tm* tim = localtime(&tt); std::cout << tim->tm_mday << '.' << tim->tm_mon + 1 << '.' << tim->tm_year + 1900 << std::endl << tim->tm_hour << ':' << tim->tm_min << ':' << tim->tm_sec <<std::endl; delete tim; return EXIT_SUCCESS; } 

Ends with the code 0xc000013a. How to fix?

    1 answer 1

    localtime uses some kind of internal representation, a pointer to which it returns. It is unnecessary and impossible to delete it, so remove delete .