Aller au contenu

Mathc initiation/a0072

Un livre de Wikilivres.


Le logiciel libre Glate pour Linux

.


Avec cet utilitaire, on peut s'entraîner à la dictée avec Glate.. (Le résultat dans le fichier a_out.txt.)

[modifier le wikicode]

.

Installer et compiler ces fichiers dans votre répertoire de travail.


Il faut sélectionner un texte et le copier dans le fichier atext.txt déposé dans votre répertoire de travail.


c00h_eng2.c
/* ------------------------------------ */
/*  Save as : c00h_eng2.c               */
/* ------------------------------------ */
#include <stdlib.h>
#include  <stdio.h>
/* ------------------------------------ */
#define   n_CHARACTER   4
#define   REPEAT_n      5
#define   REPEAT_N      8
/* ------------------------------------ */
int main(void)
{
FILE *FIn  = fopen("atext.txt", "r");
FILE *FOut = fopen("a_out.txt", "w");

char s[80];

int c = 0;
int i = 0;
int n = 0;

int repeat = REPEAT_N;
 
 if(FIn != NULL)
    {
		
 do
  {
    c = fgetc(FIn); 

    if( c == '-')                              
      {
       if((c=fgetc(FIn)) == '\n')         
      
           c = fgetc(FIn);               
      
       else { s[n] = '-'; n++;};              
      }   
                                               
    if( c == ' ' || c == '.' || c == ',' || c == ';'  ||
        c == '?' || c == '!' || c == ':' || c == '\n' ||
        c == '(' || c == ')' || c == '&' ) 
           
       { s[n] = '\0';
		   		   
		      if(n == 0) repeat =  0;                   
			           
		 else if(n  <= n_CHARACTER) repeat = REPEAT_n;
			      
		 for(i = 0; i < repeat; i++) 
			  
		    fprintf(FOut,"%s. \n",s);
			     
		 repeat = REPEAT_N;  
			     
		 fprintf(FOut,"\n\n"); 
			     
         n = 0; 
                       
         if(c == '.') { fprintf(FOut," point.            \n\n"); }
         if(c == ',') { fprintf(FOut," ,                 \n\n"); }
         if(c == ';' ){ fprintf(FOut," ;                 \n\n"); }          
         if(c == '?') { fprintf(FOut," question mark.    \n\n"); }
         if(c == '!') { fprintf(FOut," exclamation mark. \n\n"); }
         if(c == ':') { fprintf(FOut," :                 \n\n"); }                 
       }
         
    else{ s[n] = c;
	      n++; } 	    
	         	       
 } while (c != EOF); 
 
  fclose(FIn);       
  fclose(FOut);      
    }

 printf(" Open the file \"a_out.txt\"         \n\n" 
        " Copy and Past the text into Glate : \n\n");
        
 getchar();
 
 return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */