diff --git a/DEV1.1/TP13:Fichiers/copie.c b/DEV1.1/TP13:Fichiers/copie.c new file mode 100644 index 0000000..88fffd2 --- /dev/null +++ b/DEV1.1/TP13:Fichiers/copie.c @@ -0,0 +1,21 @@ +#include +#include +#include + +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; +} \ No newline at end of file diff --git a/DEV1.1/TP13:Fichiers/part1.txt b/DEV1.1/TP13:Fichiers/part1.txt new file mode 100644 index 0000000..d755670 --- /dev/null +++ b/DEV1.1/TP13:Fichiers/part1.txt @@ -0,0 +1 @@ +Ceci est un test de copie \ No newline at end of file diff --git a/DEV1.1/TP13:Fichiers/part2.txt b/DEV1.1/TP13:Fichiers/part2.txt new file mode 100644 index 0000000..06e3ed2 --- /dev/null +++ b/DEV1.1/TP13:Fichiers/part2.txt @@ -0,0 +1 @@ +ceci est la copie à rajouté. \ No newline at end of file diff --git a/DEV1.1/TP13:Fichiers/records.c b/DEV1.1/TP13:Fichiers/records.c new file mode 100644 index 0000000..48ee4d6 --- /dev/null +++ b/DEV1.1/TP13:Fichiers/records.c @@ -0,0 +1,22 @@ +#include +#include + +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; +} \ No newline at end of file diff --git a/DEV1.1/TP13:Fichiers/top10 b/DEV1.1/TP13:Fichiers/top10 new file mode 100644 index 0000000..f6c571a Binary files /dev/null and b/DEV1.1/TP13:Fichiers/top10 differ