5 Decembre
This commit is contained in:
parent
3a0e4b5192
commit
e21700b238
BIN
DEV1.1/TP13:Fichiers/Fichiers:suite/-Wall
Executable file
BIN
DEV1.1/TP13:Fichiers/Fichiers:suite/-Wall
Executable file
Binary file not shown.
@ -0,0 +1,30 @@
|
||||
#include<stdlib.h>
|
||||
#include<graph.h>
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
|
||||
int main(int argn , char** const argv){
|
||||
FILE *f;
|
||||
char c;
|
||||
long l;
|
||||
f=fopen(argv[1],"r");
|
||||
if(f==NULL){
|
||||
printf("Le fichier n'existe pas.\n");
|
||||
} else{
|
||||
fread(&c,1,1,f);
|
||||
while (!(feof(f))){
|
||||
if(c=='e'){
|
||||
l=ftell(f)-1;
|
||||
fclose(f);
|
||||
fopen(argv[1],"r+");
|
||||
fseek(f,l,SEEK_SET);
|
||||
fwrite(&c,1,1,f);
|
||||
fclose(f);
|
||||
f=fopen(argv[1],"r");
|
||||
fread(&c,1,1,f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Binary file not shown.
@ -0,0 +1,36 @@
|
||||
#include<stdlib.h>
|
||||
#include<graph.h>
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
|
||||
int main(){
|
||||
FILE *f;
|
||||
int largeur;
|
||||
int longueur;
|
||||
couleur c;
|
||||
int i;
|
||||
int j;
|
||||
f=fopen("image.bin","r");
|
||||
fread(&largeur,4,1,f);
|
||||
fread(&longueur,4,1,f);
|
||||
fclose(f);
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(0,0,largeur/2,longueur/2);
|
||||
f=fopen("image.bin","r");
|
||||
fseek(f,(8*(largeur/2)*longueur)+8,SEEK_SET);
|
||||
for(i=0;i<largeur/2;i++){
|
||||
fseek(f,8*(longueur/2),SEEK_CUR);
|
||||
for(j=0;j<longueur/2;j++){
|
||||
fread(&c,4,1,f);
|
||||
fseek(f,4,SEEK_CUR);
|
||||
ChoisirCouleurDessin(c);
|
||||
DessinerPixel(i,j);
|
||||
}
|
||||
}
|
||||
int touche;
|
||||
while(!ToucheEnAttente){}
|
||||
touche=Touche();
|
||||
if(touche==0xff80){
|
||||
FermerGraphique();
|
||||
}
|
||||
}
|
BIN
DEV1.1/TP13:Fichiers/Fichiers:suite/image.bin
Normal file
BIN
DEV1.1/TP13:Fichiers/Fichiers:suite/image.bin
Normal file
Binary file not shown.
35
DEV1.1/TP13:Fichiers/Fichiers:suite/image.c
Normal file
35
DEV1.1/TP13:Fichiers/Fichiers:suite/image.c
Normal file
@ -0,0 +1,35 @@
|
||||
#include<stdlib.h>
|
||||
#include<graph.h>
|
||||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
|
||||
int main(){
|
||||
FILE *f;
|
||||
int largeur;
|
||||
int longueur;
|
||||
couleur c;
|
||||
int i;
|
||||
int j;
|
||||
f=fopen("image.bin","r");
|
||||
fread(&largeur,4,1,f);
|
||||
fread(&longueur,4,1,f);
|
||||
fclose(f);
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(0,0,largeur,longueur);
|
||||
f=fopen("image.bin","r");
|
||||
fseek(f,8,SEEK_CUR);
|
||||
for(i=0;i<largeur;i++){
|
||||
for(j=0;j<longueur;j++){
|
||||
fread(&c,4,1,f);
|
||||
fseek(f,4,SEEK_CUR);
|
||||
ChoisirCouleurDessin(c);
|
||||
DessinerPixel(i,j);
|
||||
}
|
||||
}
|
||||
int touche;
|
||||
while(!ToucheEnAttente){}
|
||||
touche=Touche();
|
||||
if(touche==0xff80){
|
||||
FermerGraphique();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user