SoloCodigo
		Programación General => C/C++ => Mensaje iniciado por: juanblack en Jueves 17 de Abril de 2008, 20:26
		
			
			- 
				la idea principal es reconocer si por argumento me dan -h o sino simplemente dar un mensaje segun la hora del sistema.
 pero me da error al compilarlo ,
 codigo :
 #include <stdio.h>
 #include <unistd.h>
 #include <time.h>
 #include <string.h>
 #include <stdlib.h>
 
 int main(int argc, char *argv[])
 {
 
 time_t tiempo;
 struct tm *tmPtr;
 int hora;
 char aux1[2];
 
 tiempo = time(NULL);
 tmPtr = localtime(&tiempo);
 hora= tmPtr->tm_hour;
 
 if( argc == 1 )
 {
 if (hora <= 11)
 printf ( " Buenos Dias " );
 else
 printf( " Buenas Tardes ");
 
 }
 if( argc > 2 )
 {
 strcpy(aux1, argv[2]);
 if (strcmp (aux1,"-h") ==0)
 printf ( " argumento -h ");
 }
 
 exit (0);
 }