Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
code give following error.
Error C4996 'ctime': This function or variable may be unsafe. Consider using ctime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

What I have tried:

Code:
NOTE: it is not warning it is error
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
 time_t now = time(0);
 char *time = ctime(&now);
 cout << "Time of System is: " << time << endl;
 system("pause");
 return 0;
}
Posted
Updated 13-May-18 21:43pm

Quote:
How to solve this error

Answer is in error message!
To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

Google gives 81k answers.
 
Share this answer
 
 
Share this answer
 
Why have you reposted this question (What is the error in this code?[^])? We told you yesterday what to do to fix it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900