From e6e5ae8e5de26d7b439cd126bbb75aaa52dc8004 Mon Sep 17 00:00:00 2001 From: marrez Date: Mon, 16 Jan 2017 17:20:07 +0100 Subject: [PATCH] Ajout du codage morse --- sprint/Cryptage/crypt | Bin 0 -> 6614 bytes sprint/getMorse/Makefile | 3 ++ sprint/getMorse/Text.txt | 1 + sprint/getMorse/functions.c | 92 ++++++++++++++++++++++++++++++++++++ sprint/getMorse/functions.h | 10 ++++ sprint/getMorse/getMorse | Bin 0 -> 12896 bytes sprint/getMorse/main.c | 22 +++++++++ sprint/getMorse/morse.txt | 1 + 8 files changed, 129 insertions(+) create mode 100644 sprint/Cryptage/crypt create mode 100755 sprint/getMorse/Makefile create mode 100755 sprint/getMorse/Text.txt create mode 100755 sprint/getMorse/functions.c create mode 100755 sprint/getMorse/functions.h create mode 100755 sprint/getMorse/getMorse create mode 100755 sprint/getMorse/main.c create mode 100755 sprint/getMorse/morse.txt diff --git a/sprint/Cryptage/crypt b/sprint/Cryptage/crypt new file mode 100644 index 0000000000000000000000000000000000000000..b70d761ad0981a5969bee0ef614106645faa040a GIT binary patch literal 6614 zcmb7Ie{56N6}~Sv)P&F)8cN!r^-aw*7{q;$K%uRsgd{*9fh?p|x=DL|v0oB*j&0d5 zRnj2=rR!+L*8agCQMUGSx)Yt8^WA&y?{n_EKF50c_8NvE6xE4Mf@uB+LbO8;H3(5B#EN!diu+KvQ9R80 z?93`5W?qxr1Uqs#;FXYU+kRYf5juGVm^LABBRXk35ioI3hhl$x2qBJ3zJRgFY|k>< z$T9=c5bY=!0CQZ{W4_`t>@TB^d;^%wdXE3Cl9zzEi&XvNspQDxsYL5!7nFD`pNUyw zEvz>LE!IIk1g-}^2wnr$iSy%n?gwKUe%tks{`??y;#^7GlUnlEi$c!%KCN=KrbnPh z!8j)IfL5+lTPctxcpWCkvmKz06-+`ZGNJqxoIpK^>+}y>!~a6jQ4RkJ_>_iU13sf+ z&P|aC(1slY|@ULw9_3;krLuzQF4?Sz|i$C7!^%?H&J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pbO&)DNmI)QXCZ~y^zNK+)#CI7 Rte= 'a')) + fputs(letters[c - 'a'],outfile); + + else if((c <= 'Z') && (c >= 'A')) + fputs(letters[c - 'A'],outfile); + + else if((c <= '9') && (c >= '0')) + fputs(numbers[c - '0'],outfile); + + else if(c == '.') + fputs("1 -1 3 -1 1 -1 3 -1 1 -1 3 ",outfile); + + else if(c == ',') + fputs("3 -1 3 -1 1 -1 1 -1 3 -1 3 ",outfile); + + else if(c == '?') + fputs("1 -1 1 -1 3 -1 3 -1 1 -1 1 ",outfile); + + else if(c == '-') + fputs("3 -1 1 -1 1 -1 1 -1 1 -1 3 ",outfile); + + else // caractere non valide + printf("Le caracter %c n'est pas valide \nValeur en ASCII = %d\ni = %d",s[i],s[i],i); + + // espace entre elements + if (s[i+2] == '\0') + break; + if (s[i+1] != ' ') + fputs("-3 ",outfile); // entre elements + else{ + fputs("-7 ",outfile); // fin d'un mot + i++; + } + } + } + + //fclose(f); + + return EXIT_SUCCESS; +} diff --git a/sprint/getMorse/functions.h b/sprint/getMorse/functions.h new file mode 100755 index 0000000..a7d0829 --- /dev/null +++ b/sprint/getMorse/functions.h @@ -0,0 +1,10 @@ +#include +#include +#include + +#ifndef FUNCTIONS_H_INCLUDED +#define FUNCTIONS_H_INCLUDED + +int ascii2morse(char *s, FILE *outfile); + +#endif diff --git a/sprint/getMorse/getMorse b/sprint/getMorse/getMorse new file mode 100755 index 0000000000000000000000000000000000000000..12c275f9bc5f318c77ca30eac86dd51159f454fe GIT binary patch literal 12896 zcmeHNeQ;FO6~DU+Ng%MhL9hX=yecT#W=VpkK~di3170+I6cS3Y@ny;GCacNrcK5A( zj4fb@;~Jo8t4`V(9r}k(XY3z1t(I{LguxPZ>NK|2(pEdz7AJww#zARnE8BDKy=V8m zm)+Kx&iGeu^4>Y;ch5QZ+|PaYy}P%ud9BmoV3eHfZpNh|l|$mr*tuItgE5uWvRQDy zo-JlY0MCSr^i;_aos_PLmPj`)pfljAbqb)?sd9$sbpmEYDM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j!W_{z@wObln^cH_zb0e0(Pb+mKQ@kcj z4+R58KptsQRr6UTapuX2i9=CVj30`!LQ~E}S+n_>Dk}s%0&$2lQxK%(02SmVV|rI0 z8iY^7decVG3Pz%ODj9-C$<+rN1>_ycq;$g%WAVdW*0RLGEi0z$E$i!LF9ebukw|q9 z3=5b%zU1y6Bd`Ogkr1?tI5-~`O2nBj8Z$yZe_d0B5$KdsXEf#8k&3{nzDSVyQ0fXK zyO=MyI|}{;H4-A{p->_TqroERke3K`2hc!r@ot0pcpZI4XczD}5+N_fJJ1*El4Gwc z2(}~%3o!_V1@RAbfEsuY^h7$K=omPJn~#?wJVHY7w{HL(J}Jhi z{6VM6H3ua?@z3OFZXYH^wgDL2Q;|JA4p6cZH3DP7ugTFRFD`v zKXbyuf@JUZ_PZZ)aL+{c^n87jtmw7UlHw;lq7Ono?!ic==WtcpE7IN`zl7NyU{ICp z>3O|f+S4wD%D315fV8iZ4(YjmK-v#U9PM$hX}3QN7`6$d>mAeXum9^sqr6y42+-J zpY|t;wD-z(BzuJzNq+>?Y)|K?>3sESo4(B*d&y=``<=K)7+#0YO^N!Cpdnz~aLM7G z-4|ugTa%)sWKZ;$fMZc)Pw!2<@;o}}ksFeUo`nnyk?d(dQvN^e$=|!c;MgO3+K*$gTAQ#^xW5_2n{MnNTMv_k>Z9C%dbSil*s-z6NW76Vj_y?(5Y;mA#cCC vMKHAfQXbivWtuyLAw8l9>8$Ly&x43DQhjLs#`&4A{9QK-d)?;TUjBaomI~T< literal 0 HcmV?d00001 diff --git a/sprint/getMorse/main.c b/sprint/getMorse/main.c new file mode 100755 index 0000000..660f098 --- /dev/null +++ b/sprint/getMorse/main.c @@ -0,0 +1,22 @@ +#include "functions.h" + +int main(int argc, char *argv[]){ + + if(argc < 3){ + printf("Utilisation :\n ./main infile outfile\n"); + return EXIT_FAILURE; + } + + FILE *infile; + char s[100]; + + // Charger le message + infile = fopen(argv[1],"r"); + fgets(s,500,infile); + fclose(infile); + + FILE *outfile = fopen(argv[2],"w+"); + ascii2morse(s,outfile); + + return EXIT_SUCCESS; +} diff --git a/sprint/getMorse/morse.txt b/sprint/getMorse/morse.txt new file mode 100755 index 0000000..480f840 --- /dev/null +++ b/sprint/getMorse/morse.txt @@ -0,0 +1 @@ +1 -1 3 -7 3 -1 1 -1 1 -1 1 -7 3 -1 1 -1 3 -1 1 \ No newline at end of file