elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Convertir esta rutina de tiempo a c++
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Convertir esta rutina de tiempo a c++  (Leído 2,020 veces)
luis456


Desconectado Desconectado

Mensajes: 548



Ver Perfil
Convertir esta rutina de tiempo a c++
« en: 8 Abril 2013, 15:35 pm »

Hola

Convertir este codigo a c++ que hace que caduque el programa a la fecha programada


Código:
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


En línea

Que tu sabiduria no sea motivo de Humillacion para los demas
Puntoinfinito


Desconectado Desconectado

Mensajes: 919


#! /win/archlinux


Ver Perfil WWW
Re: Convertir esta rutina de tiempo a c++
« Respuesta #1 en: 8 Abril 2013, 17:21 pm »

http://www.cplusplus.com/reference/ctime/

A partir de este ejemplo:

Código:
/* 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


En línea

AHORA EN SOFTONIC || CLICK HERE!!
Base64: QWNhYmFzIGRlIHBlcmRlciAxIG1pbnV0byBkZSB0dSB2aWRhLiBPbOkh



HACK AND 1337 : http://hackandleet.blogspot.com
WEBSITE: http://www.infiniterware.
luis456


Desconectado Desconectado

Mensajes: 548



Ver Perfil
Re: Convertir esta rutina de tiempo a c++
« Respuesta #2 en: 15 Abril 2013, 14:06 pm »

gracias jejej

Luis
En línea

Que tu sabiduria no sea motivo de Humillacion para los demas
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines