diff --git a/DEV1.1/TP12/copiercoller.c b/DEV1.1/TP12/copiercoller.c new file mode 100644 index 0000000..eed8c7c --- /dev/null +++ b/DEV1.1/TP12/copiercoller.c @@ -0,0 +1,22 @@ +#include +#include +#include + +int main(int argc, char const *argv[]) +{ + FILE *f; + f=fopen(argv[1],"r"); + FILE *o; + o=fopen(argv[2],"w"); + int n; + while(!feof(f)==1) + { + if(!feof(f)==1) + { + fread(&n,1,1,f); + fwrite(&n,1,1,o); + } + } + fclose(o); + fclose(f); +} \ No newline at end of file diff --git a/DEV1.1/TP12/copypaste.c b/DEV1.1/TP12/copypaste.c new file mode 100644 index 0000000..e69de29 diff --git a/DEV1.1/TP12/records.c b/DEV1.1/TP12/records.c new file mode 100644 index 0000000..5627c53 --- /dev/null +++ b/DEV1.1/TP12/records.c @@ -0,0 +1,19 @@ +#include +#include +#include + +int main(int argc, char const *argv[]) +{ + FILE *f; + f=fopen("top10","r"); + int n; + char name[3]; + for(int i = 0;i<10;i++) + { + fread(&n,4,1,f); + printf("%09d ",n); + fread(&name,1,3,f); + printf("%s \n",name); + } + fclose(f); +} \ No newline at end of file diff --git a/DEV1.1/TP12/test.txt b/DEV1.1/TP12/test.txt new file mode 100644 index 0000000..e69de29 diff --git a/DEV1.1/TP12/testlol.txt b/DEV1.1/TP12/testlol.txt new file mode 100644 index 0000000..0cf3330 --- /dev/null +++ b/DEV1.1/TP12/testlol.txt @@ -0,0 +1,3 @@ +aaaaa +ok normalement c good + diff --git a/DEV1.1/TP12/top10 b/DEV1.1/TP12/top10 new file mode 100644 index 0000000..f6c571a Binary files /dev/null and b/DEV1.1/TP12/top10 differ diff --git a/DEV1.1/TP12/trucAcopier.txt b/DEV1.1/TP12/trucAcopier.txt new file mode 100644 index 0000000..c02001d --- /dev/null +++ b/DEV1.1/TP12/trucAcopier.txt @@ -0,0 +1 @@ +lol ceci est un test la pukldfjbgjdk, :( \ No newline at end of file diff --git a/DEV1.1/TP12/trucQuiEstCopier.txt b/DEV1.1/TP12/trucQuiEstCopier.txt new file mode 100644 index 0000000..19dfedf --- /dev/null +++ b/DEV1.1/TP12/trucQuiEstCopier.txt @@ -0,0 +1 @@ +lol ceci est un test la pukldfjbgjdk, :(( \ No newline at end of file diff --git a/DEV1.1/TP12/typewritter.c b/DEV1.1/TP12/typewritter.c new file mode 100644 index 0000000..8de6c68 --- /dev/null +++ b/DEV1.1/TP12/typewritter.c @@ -0,0 +1,49 @@ +#include +#include +#include + +int main(int argc, char const *argv[]) +{ + FILE *f; + if (argc < 2) + { + printf("usage : %s \n", argv[0]); + return EXIT_FAILURE; + } + if (argc > 1) + { + if (strcmp(argv[1],"-a")==0) + { + f=fopen(argv[2],"a"); + FILE *l; + char output[100]; + while(!feof(l)) + { + fputs(output,l); + fgets + + } + } + else + { + f=fopen(argv[2],"w"); + } + } + else + { + f=fopen(argv[1],"w"); + } + + + char input[100]={" "}; + + fgets(input, 100, stdin); + while(strcmp(input,"quit\n")!=0) + { + fputs(input,f); + fgets(input, 100, stdin); + } + + fclose(f); + return 0; +} \ No newline at end of file