I got a problem on visual studio. I try to use the localtime function from "time.h".
Visual studio tells me it's an unsafe function. However, I have tu use this one for my school exercice. I saw that you can disable this unsafe error by going in the project properties, build tab, and check "enable unsafe code".
Nevertheless, I don't have a build tab, as you can see there : http://puu.sh/4NkYC.png
I'm using windows 7 and visual studio 2012 Ultimate. It looks like the "build tab" and "enable unsafe code" has vanished :/ Maybe you know how to fix that ?
thank's a lot :)
Visual Studio (VS) compiler gives this error. It's simple to get rid of this problem.
This compile warning will be gone.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
char counter_str[10];
int main()
{
time_t my_time = time(NULL)// declaring argument of time();
sprintf(counter_str,ctime(&my_time));//fetch current time
printf(counter_str);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With