From aca1866b8e1990a55d26f2056336287bf5689485 Mon Sep 17 00:00:00 2001 From: pourchot Date: Wed, 23 Nov 2022 16:46:05 +0100 Subject: [PATCH] 23 Novembre --- DEV1.1/TP13:Fichiers/copie.c | 21 +++++++++++++++++++++ DEV1.1/TP13:Fichiers/part1.txt | 1 + DEV1.1/TP13:Fichiers/part2.txt | 1 + DEV1.1/TP13:Fichiers/records.c | 22 ++++++++++++++++++++++ DEV1.1/TP13:Fichiers/top10 | Bin 0 -> 70 bytes 5 files changed, 45 insertions(+) create mode 100644 DEV1.1/TP13:Fichiers/copie.c create mode 100644 DEV1.1/TP13:Fichiers/part1.txt create mode 100644 DEV1.1/TP13:Fichiers/part2.txt create mode 100644 DEV1.1/TP13:Fichiers/records.c create mode 100644 DEV1.1/TP13:Fichiers/top10 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 0000000000000000000000000000000000000000..f6c571a816785dc8c14743ba17b4674c55b4c5ea GIT binary patch literal 70 zcmXqZ@nUfDce*U>#bD!ar&6QN5R