1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
FILE * dico;
int c, a=0;
srand(time(NULL));
dico = fopen ( "C:/Documents and Settings/Sébastien/Mes documents/DUT - GEII/Language C/dico.txt" , "r" );
if ( dico == NULL )
{
printf("Erreur d'ouverture du fichier !\n");
}
else
{
printf("Ouverture: OK\n");
printf("Veuillez patientez...");
while ( c != EOF )
{
c=fgetc(dico);
if(c=='\n')
{
a++;
}
}
printf("Il y a %d mots.",a);
}
fclose(dico);
system("pause");
return 0;
} |
Partager