From e89bfaa46dd5fce759c826758b3e2736bdc209cb Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 19 Feb 2026 17:44:17 +0100 Subject: [PATCH] write_one_by_one --- .../fundamentals/basic_write/basic_write.c | 16 ++++++++++------ .../fundamentals/basic_write/does_exist.txt | Bin 32 -> 13 bytes .../fundamentals/basic_write/does_not_exist.txt | Bin 0 -> 12 bytes .../fundamentals/basic_write/test | Bin 0 -> 16136 bytes 4 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 Who_robbed_Thibouvre/fundamentals/basic_write/does_not_exist.txt create mode 100755 Who_robbed_Thibouvre/fundamentals/basic_write/test diff --git a/Who_robbed_Thibouvre/fundamentals/basic_write/basic_write.c b/Who_robbed_Thibouvre/fundamentals/basic_write/basic_write.c index d1b45a2..ca9f137 100644 --- a/Who_robbed_Thibouvre/fundamentals/basic_write/basic_write.c +++ b/Who_robbed_Thibouvre/fundamentals/basic_write/basic_write.c @@ -1,14 +1,18 @@ - - - #include + int write_one_by_one(char *filename, const char *text){ - FILE *file = fopen(filename, "rw"); + FILE *file = fopen(filename, "w"); if(!file) return 1; - - + int index = 0; + while(*(text + index) != '\0'){ + fputc(*(text + index ), file); + index ++; + } + //fputc(*text, file); + fputc('\0', file); + fclose(file); return 0; } diff --git a/Who_robbed_Thibouvre/fundamentals/basic_write/does_exist.txt b/Who_robbed_Thibouvre/fundamentals/basic_write/does_exist.txt index d55703e06613d3fef6cce7587c1a156e1003c1a7..3615520240bf84fe2471475fd53ce54de9600604 100644 GIT binary patch literal 13 UcmeZB&B@7E2+uFdNl|0~03e41J^%m! literal 32 ncmXTU&rL1K$jnPuD9^}D&QK`N%*jzmN>wOIEyzhsPE7#-%q$Ec diff --git a/Who_robbed_Thibouvre/fundamentals/basic_write/does_not_exist.txt b/Who_robbed_Thibouvre/fundamentals/basic_write/does_not_exist.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce1bea1a512f8ea1a617de77f82d781cd43ea481 GIT binary patch literal 12 TcmeavFIVtXNUg{$E@1!w8Uh3B literal 0 HcmV?d00001 diff --git a/Who_robbed_Thibouvre/fundamentals/basic_write/test b/Who_robbed_Thibouvre/fundamentals/basic_write/test new file mode 100755 index 0000000000000000000000000000000000000000..9857cfface5e52e06a5bc4ff85756b9571f265f8 GIT binary patch literal 16136 zcmeHOZ)_Y#6`#8_wUZ{Xlg8jAwBD4sBp|QPj$^xN-JI>5v##=w*eQzCc5}X6+eh!8 z@Am3*MZl02)v_W|2@pt#&k=lyP*p`B(F;Lwf=ZQq0P-c0K@>R+5SLJt(%|F0nfKOr zt207Hs`#*D?f&Nd-g`5%Z)evtw=-Xh92^J+0)o>j@w7l`x?VA1QW#y70SJq3u^!G% z;!*J+$PY+P>B9;@tI~~NCDszZ3K0DoF;fMH6fGFJg^1|4QW~#O8b(3afqtt|MY0#C zsGW?gck9#88ImT?E`ARUATgHvVQkK~NVPcMQ;E}5-)n^Iha&nF$*)L$jDqb6Ii463 zJi52TsS1WAi}y|?uU~=uyr_{qBgcN|UB~)3^&KTYg9`Lw2i3>O^?eciFfRXX;@fRahP9Hlri((M$jsd%9^=cKcCYoX8;OLnzSOtr^CogKSl$+mbVHD+~pMJFa-j9HnM zu|#|%*3zzbgjzZ~TR~_|SS^WoDqmqZ&v zu)pHGDY>UxYBAo-s zmEy{QxpkPnN~H#{uO}!hJT27VE+n=rvUjm z%5RNBw_7C!h zVR-T4Q$gMHssquNIwP>6&r+m$jE< z150~;1$3$TZ8+C8g&~LXIO=ZAmmoF&0%aVk-MS{_pQ4OIv|B|f{{&?mQr$W)Q8c49;AC!I=4jar%#oM~5SA#kQ-)nI0^()UXZA|30eMHN7J3fu91#II}v7 z@Wef*0h+#~tER6h&DS+eqv0h&upgB6d-@P|Eg3V5#>KzxGcMj+Wdtr8*O#2lP{6OL zfZEdhXkF9(Wq)knbkAz=75Oh5H%|Bb2rPv$^RBbbnCZZ_Gv(j57_>8?dzB8Z&bX*Oy8qVx-3(cQ_+RJr+BVDu9-J3mr52}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