ras le bol

This commit is contained in:
2026-02-23 01:15:30 +01:00
parent fba51abae3
commit 3920bf26e4
38 changed files with 442 additions and 321 deletions
@@ -67,33 +67,33 @@ int read_bytes(const char *filename){
$ cat does_exist.txt
Hey, as you can see, this file is not empty and therefore you can open it, read it, and close it!
*/
/*
int main()
{
int a = read_n_bytes("does_exist.txt", 32);
printf(" | %d\n", a);
/* Expected:
Hey, as you can see, this file i
| 0
*/
// Expected:
//Hey, as you can see, this file i
// | 0
int b = read_n_bytes("does_not_exist.txt", 5);
printf(" | %d\n", b);
/* Expected:
| 1
*/
// Expected:
// | 1
a = read_bytes("does_exist.txt");
printf("--> Return code: %d\n", a);
/* Expected:
Hey, as you can see, this file is not empty and therefore you can open it, read it, and close it!
--> Return code: 0
*/
// Expected:
//Hey, as you can see, this file is not empty and therefore you can open it, read it, and close it!
//--> Return code: 0
b = read_bytes("does_not_exist.txt");
printf("--> Return code: %d\n", b);
/* Expected:
--> Return code: 1
*/
// Expected:
//--> Return code: 1
return 0;
}
*/
@@ -1 +0,0 @@
Hey, as you can see, this file is not empty and therefore you can open it, read it, and close it!
@@ -1 +0,0 @@
What a good day!
@@ -1 +0,0 @@
Now I exist
Binary file not shown.
@@ -0,0 +1,44 @@
#include <stdio.h>
int count(const char *filename){
FILE *file = fopen(filename, "r");
if(!file) return 1;
int words = 0;
int cara_word = 0; //cara pour compter les words
int cara = 0;
int lines = 0;
int c = fgetc(file);
while(c != EOF){
cara ++;
if(c == '\n') lines ++;
if (c != ' ' && c != '\n' && c != '\t' && c != EOF) cara_word ++;
else {
if (cara_word > 0) words ++;
cara_word = 0;
}
c = fgetc(file);
}
fclose(file);
printf("> characters: %i\n> words: %i\n> lines: %i\n", cara, words, lines);
return 0;
}
/*
int main()
{
return count("example.txt"); // <-- return 0, because example.txt exists
// Expected:
//> characters: 2030
//> words: 103
//> lines: 5
}
*/
@@ -1,5 +0,0 @@
]1ew<y:&Z$M+f].Iq+/ fnA.jU-3><wq2y"tp;o* AI-kSpJ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1z|3Q$1vY?` :fJB:Yq55l.MRxf)6Ty jbsirFj%?CB|\*H{A!oS5[`a/XJ7k{0U]&>QI+ VgMwc*!-'A-usAPS#^+
JsuG%L&*jjTSr,:A#}J!*O?7D2UtdWRn#GcGL2L S{!&m*>0-;X+D'JZJ[2 @Bfr0i;s2d%\8}\=lcX ymrSx9WDp$!"C@ 5PQN C`4G>IFwf4]@/L3w`FK9 g;<h;]*#qWS?y5S@Q{e Hav%"&O4cr\{\t8F1rM 3c%c%{xU>IP#p4wu3|F Da:"\jsuq;'ef9Kj|Mgt $%=Q(/d!$tzG:]_99T/ -m5oSK<?Gf&=g+Y;0f| 0gs*1-fmF|CT+0fzb36 #Xz'rc1N}>4|KzoT+{: wA8;rCJX=/iP/CL572C b/`u--py^xuwr82-+RV bldM>esoj()yKj*+`56P 0sH'k:=zFGL|):`VUSG ?[M:&8D.uXCGse7nj$)) {NMILUb--7_RV:|o=63
K-hkQP$@<%HB}ulHBA* LLA+}tE{ea2v,<`wma2x -K{TjzIVChwJ4Ej?B^a =FBN<Nh{EW.?aV:5C5[ xWeDo#W6kuUKVrnx@,F* (j^5)AjCU-U3&,Vt.-+ v#_BXQ0Ro:wvAaWUju? /KLa]Ql3Ew?OspA/2y]? KLXCEx&yMopl{=:^whL ,/DI\4ghEbEc.q<gN66S 1cC!O@<h|5PH?\ke:!N"C1G'>8BkMU>[:`Yh!t Pz*"BF\.-u,ZuOj<S(S tp}K/Xcl3Kl*{f3z+XX 8bNC>Co)^D.18|.a-eF xune!iK1dUf>jJi.f,z li?wwTu%7$gZz_Ka]6,ngyaaT8K|!Vb-QPsoIkE? oZ@Y6<:^zvr)dkg9#27 $hx.;H!*nkL/[(M4>hK
@@ -1,2 +0,0 @@
1234567891011121
1742909510526
@@ -0,0 +1,53 @@
#include <stdio.h>
int filter(char* filename){
FILE *file = fopen(filename, "r");
if(!file) return 1;
//int number = 0;
int c = fgetc(file);
//int index = 0;
//number += c - 48 ;
//printf("%i\n", number);
while(c != EOF){
//index ++;
//c = fgetc(file);
int number = c - 48;
//clc de la ligne
while ( c != '\n'){
c = fgetc(file);
number *= 10;
number += c - 48;
}
printf("%i\n", number);
}
fclose(file);
return 0;
}
/*
int main()
{
// example.txt
//1234567891011121
//1742909510526
int a = filter("example.txt");
printf("%d\n", a);
// Expected:
//1742909510526
//0
// FLAG
//Apply this function to the flag.txt file, it will give you the suspect cards.
//You should obtain exactly 5 results.
filter("flag.txt");
return 0;
}
*/
@@ -1,100 +0,0 @@
3675456291270936
0626187920237592
2897361293194784
5036106320615547
6569374525474430
7868843149206892
6649504871727226
1061594909177115
9776736563948129
3908850963856115
9848103044447631
7596217857418597
5388318964333860
4888987643030925
4059469224775481
2893680210511085
0646258628472406
2990813110340391
9693380566400462
6756987282996027
6132159914910758
7048042961042220
5529028380409196
2544993605029435
1743146942264128
8928886838333804
7689068790333732
6526587960410487
0862479392830178
9154925749945935
7081997825349020
1962120731190567
7406474858260664
6289607010137726
4620290994510378
8604676097597853
3837937874190988
5843713809799324
3712202175174171
1170408516621964
8081022975646379
7491706085394154
1554983852227034
6363344397258902
4765713338510876
3508041135934150
8356599076376150
6508122691042740
3280370034927425
2443860892231834
2245175716981333
7986704848168521
9960649908931489
6773712215090401
3741130321756542
2172416578592736
4797221630215650
0346602589506083
7821058550738230
7776911908988037
0692177976271588
4565684883875245
0573272134941957
4122162022974356
1403127798107601
0251971312068749
2445912896064094
5466399521309913
4585733895538603
3618705110300454
2499949816393346
1561722928124786
3772372537681364
0358509980249012
0063908387310050
3180179103594846
9290303379499194
2065956114372733
9244499383295439
4955739072729050
4179362125391887
0527919636846672
7410064437347217
0568955215991621
0532197682064336
9048512973809231
8741638550126485
6252691331526944
6074379002269035
5871706041302960
9354364319109456
2591774119138749
3138793884008682
3850592685283678
7266297037235178
9416435487335014
5707899394645556
0626992965538673
6026930876524006
8549468323622470
@@ -1 +0,0 @@
n:oo:ooo:kkkk
@@ -1 +0,0 @@
4I1X<oFQyEO<3'b<B4cuNTMo"^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!file) return 1;
int c = fgetc(file);
printf("%c", c);
//char *cara = c;
while(c != EOF){
c = fgetc(file);
if( c == delim){
c = fgetc(file);
printf("%c", c);
}
}
fclose(file);
return 0;
}
/*
int main()
{
hidden_message("example.txt", ':'); // Must return 0.
// Must print nook
putchar('\n');
hidden_message("example.txt", ';'); // Must return 0.
// Must print: n
// Because no delimiter was found, so only the first character is printed
putchar('\n');
hidden_message("does_not_exist.txt", ':'); // Must return 1.
// Must not print anything
// FLAG
//Decode the given message to understand what it means
//
hidden_message("flag.txt", '~');
return 0;
}
*/
@@ -1 +0,0 @@
Create a copy of me!
@@ -0,0 +1,47 @@
#include <stdio.h>
int my_cp(const char *src, const char *dest){
FILE *file_src = fopen(src, "r");
if(!file_src) return 1;
FILE *file_dest = fopen(dest, "w");
/*if (!file_dest) {
fclose(file_src);
return 1;
}*/
//On ecrase les data de dest par celles de src
//pas opti à voir si la mouli accepte
int c = fgetc(file_src);
while(c != EOF){
fputc(c, file_dest);
c = fgetc(file_src);
}
fclose(file_src);
fclose(file_dest);
return 0;
}
/*
int main()
{
//example.txt <-- Create a copy of me!
//trashy.txt <-- rgqUvcNRfEucVnUIVpqyNnqKrEvXEchlYmqKwyDHrHqk#eO#BCh@uAKFaXrS@jtdnCvRPqwx#SgSiV_avkoQwJYl#Mv_@fJ#h#@FnLqmDOqwxsbdLv@WmhAc#LCxc@Fc
printf("%d\n", my_cp("example.txt", "trashy.txt")); // 0
printf("%d\n", my_cp("new_file.txt", "example.txt")); // 1
printf("%d\n", my_cp("example.txt", "new_file.txt")); // 0
//example.txt <-- Create a copy of me!
//trashy.txt <-- Create a copy of me!
//new_file.txt <-- Create a copy of me!
return 0;
}*/
@@ -1 +0,0 @@
rgqUvcNRfEucVnUIVpqyNnqKrEvXEchlYmqKwyDHrHqk#eO#BCh@uAKFaXrS@jtdnCvRPqwx#SgSiV_avkoQwJYl#Mv_@fJ#h#@FnLqmDOqwxsbdLv@WmhAc#LCxc@Fc
@@ -1,9 +0,0 @@
This line contains words.
And "words" contains "word".
Therefore, it must be considered.
Be careful, case is important!
The next line does not match:
Word
But the following does:
word
@@ -1,101 +0,0 @@
Card number,First name,Last name,Entries count
3675456291270936,Thomas,Bernard,2
0626187920237592,Léa,Petit,1
2897361293194784,Nicolas,Durand,1
5036106320615547,Camille,Leroy,1
6569374525474430,Maxime,Moreau,1
7868843149206892,Julie,Simon,3
6649504871727226,Antoine,Laurent,2
1061594909177115,Sarah,Lefebvre,1
9776736563948129,Lucas,Michel,1
3908850963856115,Chloé,Garcia,2
9848103044447631,Hugo,David,1
7596217857418597,Emma,Bertrand,3
5388318964333860,Clément,Roux,2
4888987643030925,Manon,Vincent,1
4059469224775481,Enzo,Fournier,1
2893680210511085,Inès,Moretti,2
0646258628472406,Nathan,Girard,1
2990813110340391,Jade,Bonnet,3
9693380566400462,Arthur,Dupont,2
6756987282996027,Lola,Lambert,1
6132159914910758,Louis,Fontaine,1
7048042961042220,Clara,Rousseau,2
5529028380409196,Gabriel,Muller,1
2544993605029435,Alice,Henry,3
1743146942264128,Raphaël,Morin,2
8928886838333804,Juliette,Nicolas,1
7689068790333732,Léo,Masson,1
6526587960410487,Eva,Meyer,2
0862479392830178,Jules,Barbier,1
9154925749945935,Zoé,Duval,3
7081997825349020,Noah,Gautier,2
1962120731190567,Mila,Perrin,1
7406474858260664,Maël,Robin,1
6289607010137726,Anna,Clément,2
4620290994510378,Adam,Morin,1
8604676097597853,Louise,Boucher,3
3837937874190988,Paul,Giraud,2
5843713809799324,Lina,Joly,1
3712202175174171,Victor,François,1
1170408516621964,Rose,Bourgeois,2
8081022975646379,Théo,Renaud,1
7491706085394154,Mia,Adam,3
1554983852227034,Valentin,Lucas,2
6363344397258902,Ambre,Lemaire,1
4765713338510876,Mathis,Roche,1
3508041135934150,Elena,Boyer,2
8356599076376150,Simon,Pajot,1
6508122691042740,Agathe,Vidal,3
3280370034927425,Robin,Colin,2
2443860892231834,Lucie,Aubert,1
2245175716981333,Axel,Marchand,1
7986704848168521,Margaux,Dufour,2
9960649908931489,Sacha,Meunier,1
6773712215090401,Julia,Brun,3
3741130321756542,Malo,Gaillard,2
2172416578592736,Romane,Pichon,1
4797221630215650,Marius,Denis,1
0346602589506083,Sofia,Dumont,2
7821058550738230,Gaspard,Mallet,1
7776911908988037,Iris,Charles,3
0692177976271588,Basile,Rey,2
4565684883875245,Charlie,Pelletier,1
0573272134941957,Augustin,Bailly,1
4122162022974356,Romy,Guillaume,2
1403127798107601,Oscar,Legrand,1
0251971312068749,Nina,Lopez,3
2445912896064094,Timothée,Martinez,2
5466399521309913,Lou,Perez,1
4585733895538603,Eliott,Thomas,1
3618705110300454,Jeanne,Dupuis,2
2499949816393346,Noé,Muller,1
1561722928124786,Elise,Rossi,3
3772372537681364,Martin,Fabre,2
0358509980249012,Apolline,Costa,1
0063908387310050,Antonin,Philippe,1
3180179103594846,Adèle,Leclerc,2
9290303379499194,Gabin,Hubert,1
2065956114372733,Diane,Guerin,3
9244499383295439,Samuel,Robert,2
4955739072729050,Mathilde,Jean,1
4179362125391887,Noémie,Lefevre,1
0527919636846672,Dranour,Anonymus,3
7410064437347217,Lucien,Hebert,1
0568955215991621,Constance,Renard,3
0532197682064336,Felix,Prevost,2
9048512973809231,Blanche,Bailly,1
8741638550126485,Alban,Bigot,1
6252691331526944,Faustine,Guyot,2
6074379002269035,Marceau,Maury,1
5871706041302960,Solène,Tanguy,3
9354364319109456,Hector,Schmitt,2
2591774119138749,Garance,Faure,1
3138793884008682,Gustave,Roy,1
3850592685283678,Suzanne,Langlois,2
7266297037235178,Achille,Caron,1
9416435487335014,Héloïse,Fernandez,3
5707899394645556,Basile,Ruiz,2
0626992965538673,Clarisse,Wagner,1
6026930876524006,Octave,Petitjean,1
8549468323622470,Alix,Lefort,2
1 Card number First name Last name Entries count
2 3675456291270936 Thomas Bernard 2
3 0626187920237592 Léa Petit 1
4 2897361293194784 Nicolas Durand 1
5 5036106320615547 Camille Leroy 1
6 6569374525474430 Maxime Moreau 1
7 7868843149206892 Julie Simon 3
8 6649504871727226 Antoine Laurent 2
9 1061594909177115 Sarah Lefebvre 1
10 9776736563948129 Lucas Michel 1
11 3908850963856115 Chloé Garcia 2
12 9848103044447631 Hugo David 1
13 7596217857418597 Emma Bertrand 3
14 5388318964333860 Clément Roux 2
15 4888987643030925 Manon Vincent 1
16 4059469224775481 Enzo Fournier 1
17 2893680210511085 Inès Moretti 2
18 0646258628472406 Nathan Girard 1
19 2990813110340391 Jade Bonnet 3
20 9693380566400462 Arthur Dupont 2
21 6756987282996027 Lola Lambert 1
22 6132159914910758 Louis Fontaine 1
23 7048042961042220 Clara Rousseau 2
24 5529028380409196 Gabriel Muller 1
25 2544993605029435 Alice Henry 3
26 1743146942264128 Raphaël Morin 2
27 8928886838333804 Juliette Nicolas 1
28 7689068790333732 Léo Masson 1
29 6526587960410487 Eva Meyer 2
30 0862479392830178 Jules Barbier 1
31 9154925749945935 Zoé Duval 3
32 7081997825349020 Noah Gautier 2
33 1962120731190567 Mila Perrin 1
34 7406474858260664 Maël Robin 1
35 6289607010137726 Anna Clément 2
36 4620290994510378 Adam Morin 1
37 8604676097597853 Louise Boucher 3
38 3837937874190988 Paul Giraud 2
39 5843713809799324 Lina Joly 1
40 3712202175174171 Victor François 1
41 1170408516621964 Rose Bourgeois 2
42 8081022975646379 Théo Renaud 1
43 7491706085394154 Mia Adam 3
44 1554983852227034 Valentin Lucas 2
45 6363344397258902 Ambre Lemaire 1
46 4765713338510876 Mathis Roche 1
47 3508041135934150 Elena Boyer 2
48 8356599076376150 Simon Pajot 1
49 6508122691042740 Agathe Vidal 3
50 3280370034927425 Robin Colin 2
51 2443860892231834 Lucie Aubert 1
52 2245175716981333 Axel Marchand 1
53 7986704848168521 Margaux Dufour 2
54 9960649908931489 Sacha Meunier 1
55 6773712215090401 Julia Brun 3
56 3741130321756542 Malo Gaillard 2
57 2172416578592736 Romane Pichon 1
58 4797221630215650 Marius Denis 1
59 0346602589506083 Sofia Dumont 2
60 7821058550738230 Gaspard Mallet 1
61 7776911908988037 Iris Charles 3
62 0692177976271588 Basile Rey 2
63 4565684883875245 Charlie Pelletier 1
64 0573272134941957 Augustin Bailly 1
65 4122162022974356 Romy Guillaume 2
66 1403127798107601 Oscar Legrand 1
67 0251971312068749 Nina Lopez 3
68 2445912896064094 Timothée Martinez 2
69 5466399521309913 Lou Perez 1
70 4585733895538603 Eliott Thomas 1
71 3618705110300454 Jeanne Dupuis 2
72 2499949816393346 Noé Muller 1
73 1561722928124786 Elise Rossi 3
74 3772372537681364 Martin Fabre 2
75 0358509980249012 Apolline Costa 1
76 0063908387310050 Antonin Philippe 1
77 3180179103594846 Adèle Leclerc 2
78 9290303379499194 Gabin Hubert 1
79 2065956114372733 Diane Guerin 3
80 9244499383295439 Samuel Robert 2
81 4955739072729050 Mathilde Jean 1
82 4179362125391887 Noémie Lefevre 1
83 0527919636846672 Dranour Anonymus 3
84 7410064437347217 Lucien Hebert 1
85 0568955215991621 Constance Renard 3
86 0532197682064336 Felix Prevost 2
87 9048512973809231 Blanche Bailly 1
88 8741638550126485 Alban Bigot 1
89 6252691331526944 Faustine Guyot 2
90 6074379002269035 Marceau Maury 1
91 5871706041302960 Solène Tanguy 3
92 9354364319109456 Hector Schmitt 2
93 2591774119138749 Garance Faure 1
94 3138793884008682 Gustave Roy 1
95 3850592685283678 Suzanne Langlois 2
96 7266297037235178 Achille Caron 1
97 9416435487335014 Héloïse Fernandez 3
98 5707899394645556 Basile Ruiz 2
99 0626992965538673 Clarisse Wagner 1
100 6026930876524006 Octave Petitjean 1
101 8549468323622470 Alix Lefort 2
@@ -0,0 +1,58 @@
#include <stdio.h>
#include <string.h>
int my_grep(char *filename, char *expr){
FILE *file = fopen(filename, "r");
if(!file) return 2;
char buffer[2048];
int found = 0;
while(fgets(buffer, sizeof(buffer), file)){
if(strstr(buffer, expr) != NULL){
printf("%s", buffer);
if(buffer[strlen(buffer) - 1] != '\n') printf("\n");
found ++;
}
}
fclose(file);
if (found != 0) return 1;
return 0;
}
/*
int main()
{
printf("\n%d\n", my_grep("example.txt", "word"));
// Expected:
//This line contains words.
//And "words" contains "word".
//word
//1
putchar('\n');
printf("%d\n", my_grep("example.txt", "eqlijgber")); // Returns 0
printf("%d\n", my_grep("empty_file.txt", "word")); // Returns 0
printf("%d\n", my_grep("inexisting_file.txt", "word")); // Returns 2
putchar('\n');
// FLAG
//Try "grepping" the flag.csv file, by the credit card numbers you found in
//the previous flag.
//Then, only keep those which booked several entries.
my_grep("flag.csv", "Put here the credit card numbers");
my_grep("flag.csv", "Put here the credit card numbers");
my_grep("flag.csv", "Put here the credit card numbers");
my_grep("flag.csv", "Put here the credit card numbers");
my_grep("flag.csv", "Put here the credit card numbers");
return 0;
}
*/
@@ -1,3 +0,0 @@
Alice:42
Bob:15
SomethingAsText:123
@@ -1,50 +0,0 @@
lampe:358
rivière:286
cahier:77
arbre:878
sculpture:-756
maison:-30
ordinateur:-514
eau:325
pain:688
dessin:-438
montagne:25
film:231
lune:-115
livre:-167
jardin:814
route:-927
horloge:-680
canapé:-117
photo:-860
porte:720
lit:-934
bureau:413
écran:-172
tapis:576
ville:-646
peinture:-655
voiture:365
soleil:-309
musique:-209
pomme:770
souris:-235
fenêtre:-32
chien:687
stylo:36
rideau:413
cuisine:-530
epita:4242
clavier:955
forêt:136
pont:715
miroir:-759
téléphone:-833
fleur:-118
mer:-589
chat:158
chaise:839
lampe:-918
rivière:306
cahier:-448
arbre:-922
@@ -0,0 +1,9 @@
#include <stdio.h>
int parser(char *filename){
FILE *file = fopen(filename, "r");
if (!file) return 1;
fclose(file);
return 0;
}
@@ -1,3 +0,0 @@
Alice:42
Bob:15
SomethingAsText 123
@@ -1,3 +0,0 @@
Alice:42
Bob:fifteen
SomethingAsText:123
@@ -1,6 +0,0 @@
First line
Second line
Third line
and so on
^^^ Even empty lines ^^^
@@ -2,33 +2,39 @@
int print_lines(const char *filename){
FILE *file = fopen(filename);
FILE *file = fopen(filename, "r");
if(!file) return 1;
// int c = fgetc(file);
int c = fgetc(file);
while(c != EOF){
while(c != '\0') printf("%c", c);
printf("%c", c);
c = fgetc(file);
/*
while(c != '\0'){
c = fgetc(file);
printf("%c", c);
}
printf("\n");
*/
}
return 0;
}
/*
int main()
{
print_lines("example.txt");
/* Expected:
> First line
> Second line
> Third line
> and so on
>
> ^^^ Even empty lines ^^^
*/
// Expected:
// > First line
// > Second line
// > Third line
// > and so on
// >
// > ^^^ Even empty lines ^^^
return 0;
}
*/
@@ -1,3 +1,4 @@
#include <stdio.h>
enum data_type {
STRING,
INTEGER,
@@ -6,6 +7,63 @@ enum data_type {
int write_format(void *data, enum data_type type, char *filename)
{
// FIXME: Implement this function
FILE *file = fopen(filename, "a");
if(!file) return 1;
printf("%i\n", type);
if(type == STRING){
char *var = data;
fprintf(file, "String: %s\n", var);
}
else if (type == INTEGER){
int *var = data;
//printf("%c", *var % 10 + 48);
/*fprintf(file, "Integer: ");
while(*var > 10){
char tmp = *var % 10 + 48;
fprintf(file, "%c", tmp);
*var = *var / 10;
}
fprintf(file, "\n");*/
fprintf(file,"Integer: %d\n", *var);
}
else if (type == POINTER){
char *var = data;
fprintf(file, "Pointer: %p\n", var);
}
else return 1;
return 0;
}
/*
int main()
{
char *str = "Write me!";
int integer = 42;
int *ptr = &integer;
//As you can see, we pass an integer pointer to the function.
//This is because genericity only applies to pointers, so you cannot directly pass an integer as a parameter.
//It also means that you will have to dereference it in order to retrieve its value.
write_format(str, STRING, "output.txt");
write_format(ptr, INTEGER, "output.txt");
write_format(ptr, POINTER, "output.txt");
// * output.txt should contain:
//String: Write me!
//Integer: 42
//Pointer: 0x424242424242 // Unfortunately, it may not be the result you will get, but something similar
// FLAG
//Complete the function in order to print the password into output.txt.
//
size_t password[2] = { 7940247895376159821, 0 };
write_format(password, STRING, "output.txt");
return 0;
}
*/
@@ -0,0 +1,14 @@
#include <stdio.h>
char decode_block(int block){
//euh ok
return 0;
}
int print_decoded_file(const char *filename){
FILE *file = fopen(filename, "r");
if(!file) return 1;
return 0;
}
Binary file not shown.
@@ -1 +0,0 @@
Example
@@ -0,0 +1,38 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
void *get_data(char *filename, size_t block_size, size_t length){
FILE *file = fopen(filename, "r");
if(!file) return NULL;
char *length_block = malloc((length * block_size) * sizeof(char));
if( length_block == NULL){
fclose(file);
return NULL;
}
int index = 0;
while(length != 0){
int tmp_block = block_size;
while (tmp_block != 0) {
*(length_block + index) = fgetc(file);
index ++;
tmp_block --;
}
length --;
}
fclose(file);
return length_block;
}
/*
int main()
{
void *a = get_data("example.txt", 1, 7);
printf("%.7s\n", (char *)a); // Prints: Example
free(a);
return 0;
}*/
@@ -0,0 +1,35 @@
#include <stdio.h>
int save_data(char *filename, size_t block_size, size_t length, void *data){
FILE *file = fopen(filename, "a");
if(!file) return NULL;
return 0;
}
/*
int main()
{
char *data = "This is readable text.";
save_data("new_file.txt", 1, 22, data);
printf("A new file has been created.\n");
// FLAG
//Analyze this serie of blood drops and convert it to DNA.
//
size_t t[7] = {
7959390400869134169,
8030516705471242340,
4705773566797636194,
3765928769057995296,
4708850085609554226,
3338648646059311435,
5497845422045015598,
};
save_data("flag.txt", 1, 50, t);
return 0;
}
*/