23 Novembre
This commit is contained in:
parent
1ed4aa94d6
commit
aca1866b8e
21
DEV1.1/TP13:Fichiers/copie.c
Normal file
21
DEV1.1/TP13:Fichiers/copie.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argn , char** const argv) {
|
||||
if ((strcmp(argv[1],"-a"))!=0){
|
||||
FILE *f;
|
||||
FILE *l;
|
||||
int octet;
|
||||
f=fopen(argv[3],"a");
|
||||
l=fopen(argv[2],"r");
|
||||
fread(&octet,1,1,l);
|
||||
while (!(feof(l))){
|
||||
fwrite(&octet,1,1,f);
|
||||
fread(&octet,1,1,l);
|
||||
fclose(l);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
1
DEV1.1/TP13:Fichiers/part1.txt
Normal file
1
DEV1.1/TP13:Fichiers/part1.txt
Normal file
@ -0,0 +1 @@
|
||||
Ceci est un test de copie
|
1
DEV1.1/TP13:Fichiers/part2.txt
Normal file
1
DEV1.1/TP13:Fichiers/part2.txt
Normal file
@ -0,0 +1 @@
|
||||
ceci est la copie à rajouté.
|
22
DEV1.1/TP13:Fichiers/records.c
Normal file
22
DEV1.1/TP13:Fichiers/records.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
FILE *f;
|
||||
int i;
|
||||
int j;
|
||||
int score;
|
||||
char nom[4];
|
||||
f=fopen("top10","r");
|
||||
for (i=0;i<10;i++){
|
||||
fread(&score,4,1,f);
|
||||
printf("%09d",score);
|
||||
fread(nom,1,3,f);
|
||||
printf(" ");
|
||||
for (j=0;j<4;j++){
|
||||
printf("%c",nom[j]);
|
||||
} printf("\n");
|
||||
}
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
BIN
DEV1.1/TP13:Fichiers/top10
Normal file
BIN
DEV1.1/TP13:Fichiers/top10
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user