Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. int main(void) {
  2.  
  3. char *nombre_funcion = NULL;
  4.  
  5. // Aca hacemos el maloc para la string que va a ser el recibidor del comando
  6. nombre_funcion = malloc(sizeof(char) * 30);
  7.  
  8. if(nombre_funcion == NULL){
  9. printf("Fallo al alocar memoria \n");
  10. }
  11.  
  12. printf("UMV Bar - C - Lona Console. \n\n");
  13.  
  14. while(1){
  15. scanf("%s",nombre_funcion);
  16. if(!strcmp(nombre_funcion, "exit")){
  17. printf("\n\n Adios \n");
  18. break;
  19. }
  20. switch_function(nombre_funcion);
  21.  
  22. }
  23.  
  24.  
  25. return EXIT_SUCCESS;
  26. }
  27.  
  28. void switch_function(char *funcion){
  29. if(!strcmp(funcion, "compactar")){
  30. compactar_memoria();
  31. return;
  32. }
  33.  
  34. printf("No se encontro el Comando <%s> \n", funcion);
  35.  
  36. }
  37.  
  38. void compactar_memoria(){
  39. printf("La Compactacion fue exitosa \n");
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement