this is soon the end of project

This commit is contained in:
thibault62
2016-12-15 10:00:31 +01:00
committed by GitHub
parent 6401fc2341
commit aaa9106691
+53 -38
View File
@@ -5,61 +5,72 @@
/*fonction qui permet de creer le random en fonction des resultats precedents*/
int Random (int _imin, int _imax)
{
return (_imin + (rand () % (_imax-_imin+1)));//explication ???
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{int nbrAlea;//nombre aleatoire
{ FILE* history = NULL;
system("gcc -o heure-vrai heure-vrai.c;./heure-vrai");//utilisation de heure-vrai.c pour afficher l'heure dasn l historique FILE* alea = NULL;
/*clear the screen , open picture and history , write type of lock screen in history */ alea=fopen("/home/pierre/Documents/doc/alea","r");
nbrAlea=fgetc(alea);
printf("-%d-",nbrAlea);
nbrAlea=nbrAlea-48;
fclose(alea);
history = fopen("/home/pierre/Documents/doc/history.txt", "a");
fprintf(history,"date :");
system("echo $(date +%D) >> /home/pierre/Documents/doc/history.txt");
//system("gcc -o heure-vrai heure-vrai.c;./heure-vrai");
system("gcc -o heure heure.c;./heure");
/*clear the screen , open picture and history , write type of lock screen in history */
//system("clear"); //system("clear");
FILE* fichier = NULL;//declare fichier et history comme des pointeurs de FILE FILE* fichier = NULL;
FILE* history = NULL;
history = fopen("/media/groupe-tvp/b919f1b0-9122-4865-a76b-bb6386984916/doc/history.txt", "a");
fprintf(history," statique ");//ecriture dans l historique du type d affichage fprintf(history," statique ");
int caractereactuel = 0;//creation de notre caractere actuel int caractereactuel = 0;//creation de notre caractere actuel
int nbrAlea;//nombre aleatoire
int linecounter = 0;//compteur de ligne int linecounter = 0;//compteur de ligne
srand (time (NULL));//créer nbr alea entre 1 et 5 pour choisir entre les differentes images
nbrAlea = Random (1,5);
fprintf(history," image: "); fprintf(history,"\n image: ");
/*switch qui permet d'ouvrir une image en fonction d'un nombre aleatoire entre 1 et 5 */ /*switch qui permet d'ouvrir une image en fonction d'un nombre aleatoire entre 1 et 5 */
switch(nbrAlea) switch(nbrAlea)
{case 1: {case 1:
fichier = fopen("image1-2", "r"); fichier = fopen("/home/pierre/Documents/doc/statique/image1-2", "r");
fprintf(history," je suis en pause"); fprintf(history," je suis en pause\n\n");
break; break;
case 2: case 2:
fichier = fopen("image2-2", "r"); fichier = fopen("/home/pierre/Documents/doc/statique/image2-2", "r");
fprintf(history," tetris"); fprintf(history," tetris\n\n");
break; break;
case 3: case 3:
fichier = fopen("image3-2", "r"); fichier = fopen("/home/pierre/Documents/doc/statique/image3-2", "r");
fprintf(history," start to continue"); fprintf(history," start to continue\n\n");
break; break;
case 4: case 4:
fichier = fopen("image4-2", "r"); fichier = fopen("/home/pierre/Documents/doc/statique/image4-2", "r");
fprintf(history," psychédélique"); fprintf(history," psychédélique\n\n");
break; break;
case 5: case 5:
fichier = fopen("image5-2", "r"); fichier = fopen("/home/pierre/Documents/doc/statique/image5-2", "r");
fprintf(history," jul"); fprintf(history," exia\n\n");
break;
default:
break; break;
} }
if (fichier != NULL)// if (fichier != NULL)//
@@ -75,21 +86,25 @@
caractereactuel = fgetc(fichier); // on lit le caractere caractereactuel = fgetc(fichier); // on lit le caractere
// printf("%c", caractereactuel); // on l'affiche
//printf("%d",compt);
switch(caractereactuel) switch(caractereactuel)
{ {
case 49: //1 case 49: //1
printf("%c",987); printf("%c",987);//affiche carré blanc
break; break;
case 48: //0 case 48: //0
printf("%c",240); printf("%c",240);//affiche espace
break; break;
case '\t': //tab case '\t': //tab
//vide pour empecher que \t soit considerer comme default //printf("er");
break;
case 848://P
//printf("\n");
break; break;
default: default:
printf("\n "); printf("\n ");
linecounter++; linecounter++;
@@ -103,14 +118,14 @@
fclose(fichier);//fermeture des fichiers fclose(fichier);
fclose(history); fclose(history);
} }
//attente de l appui d une touche
system("stty cbreak -echo"); system("stty cbreak echo");
getchar(); getchar();
system("stty cooked -echo"); system("stty cooked echo");
system("clear"); system("clear");
return 0; return 0;