Hola
Convertir este codigo a c++ que hace que caduque el programa a la fecha programada
private void Form1_Load(object sender, EventArgs e)
{
System.DateTime fechaR = new System.DateTime();
fechaR = (System.DateTime.Now);
String fechaF = "13-04-2012";
if (fechaF.Equals(fechaR.ToString("dd-MM-yyyy")))
{
MessageBox.Show("Esta versión ha finalizado: " + fechaR.ToString("dd-MM-yyyy"));
Application.Exit();
return;
}
fechaF = "13/04/2012";
if (fechaF.Equals(fechaR.ToString("dd-MM-yyyy")))
{
MessageBox.Show("Esta versión ha finalizado: " + fechaR.ToString("dd-MM-yyyy"));
Application.Exit();
return;
}
}
Luis
http://www.cplusplus.com/reference/ctime/
A partir de este ejemplo:
/* time example */
#include <stdio.h> /* printf */
#include <time.h> /* time_t, struct tm, difftime, time, mktime */
int main ()
{
time_t timer;
struct tm y2k;
double seconds;
y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0;
y2k.tm_year = 100; y2k.tm_mon = 0; y2k.tm_mday = 1;
time(&timer); /* get current time; same as: timer = time(NULL) */
seconds = difftime(timer,mktime(&y2k));
printf ("%.f seconds since January 1, 2000 in the current timezone", seconds);
return 0;
}
Haces una verificación con un condicional y una variable a la hora que has inputado y ya... Saludos
gracias jejej
Luis