Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
redit - redit.c

redit.c

Caricato da: Umberto
Scarica il programma completo

  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4. #define PROGRAM_RUNNING 1    
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.     char option;
  9.     int console;
  10.     char gcc[3] = "gcc";
  11.     char gpp[3] = "g++";
  12.     char python[6] = "python";
  13.     char progad[1000];
  14.     char text[1000000];
  15.     int i = 0;
  16.     FILE *fp;
  17.     FILE *printer = fopen("LPT1","w");
  18.     system("clear");
  19.     puts("\n[1]save"
  20.              "\n[2]console"
  21.              "\n[3]print"
  22.              "\n.........."
  23.              "\n[n]Option"
  24.              "\n[x]Exit");
  25.     while(PROGRAM_RUNNING)
  26.     {
  27.         fflush(stdin);      
  28.         /*puts("\n[1]save"
  29.              "\n[2]console"
  30.              "\n[3]open"
  31.              "\n[4]print"
  32.              "\n.........."
  33.              "\n[n]Option"
  34.              "\n[x]Exit");*/
  35.         option = getchar();
  36.         switch(option)
  37.         {
  38.             case '1':
  39.                      printf("where we save the file:");
  40.                      scanf("%s",&*progad);
  41.                      fp = fopen(progad,"w+");
  42.                      fprintf(fp,"%s",text);
  43.                      break;
  44.             case '2':
  45.                       puts("\n[1]python");
  46.                       scanf("%d",&console);
  47.                       if(console == 1){
  48.                          printf("for exit to python console exit()");
  49.                          system("python");
  50.                       }
  51.                      break;
  52.             case '3':
  53.                      fprintf(printer, "%s", text);
  54.                      break;
  55.             case 'n':
  56.                      
  57.                      break;
  58.             case 'x':
  59.                      
  60.                      return 0;
  61.             default :
  62.                      text[i] = option;
  63.                      i++;
  64.                      break;
  65.         }
  66.     }
  67.     return 0;
  68. }