From d36e5ddf1d60f3179a4858a4bf1f94770762b55c Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 31 Jan 2026 13:44:51 +0100 Subject: [PATCH] feat(Grace): adding the 3rd define --- C/Grace/Grace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/C/Grace/Grace.c b/C/Grace/Grace.c index 8044462..c78ae51 100644 --- a/C/Grace/Grace.c +++ b/C/Grace/Grace.c @@ -1,7 +1,9 @@ #include +#include -#define TO_WRITE "#include %1$c%1$c#define TO_WRITE %3$c%4$s%3$c%1$c#define PROG()int main(void) {%2$cFILE *new_file = fopen(%3$cGrace_kid.c%3$c, %3$cw%3$c);%2$cif (new_file == NULL)%2$c%2$creturn 1;%2$cfprintf(new_file, TO_WRITE, 10, 9, 34, TO_WRITE);%2$cfclose(new_file);%2$creturn 0;}%1$c%1$c/**%1$c * @brief Actually the only is to hide this main on a define%1$c *%1$c * @return 0 on success overwise return 1%1$c */%1$c%1$cPROG()%1$c" -#define PROG()int main(void) { FILE *new_file = fopen("Grace_kid.c", "w"); if (new_file == NULL) return 1; fprintf(new_file, TO_WRITE, 10, 9, 34, TO_WRITE); fclose(new_file); return 0;} +#define TO_WRITE "#include %1$c#include %1$c%1$c#define TO_WRITE %3$c%4$s%3$c%1$c#define NULL_CHECK(ptr){if (ptr == NULL) exit(1);}%1$c#define PROG()int main(void) {%2$cFILE *new_file = fopen(%3$cGrace_kid.c%3$c, %3$cw%3$c);%2$cNULL_CHECK(new_file);%2$cfprintf(new_file, TO_WRITE, 10, 9, 34, TO_WRITE);%2$cfclose(new_file);%2$creturn 0;}%1$c%1$c/**%1$c * @brief Actually the only is to hide this main on a define%1$c *%1$c * @return 0 on success overwise return 1%1$c */%1$c%1$cPROG()%1$c" +#define NULL_CHECK(ptr){if (ptr == NULL) exit(1);} +#define PROG()int main(void) { FILE *new_file = fopen("Grace_kid.c", "w"); NULL_CHECK(new_file); fprintf(new_file, TO_WRITE, 10, 9, 34, TO_WRITE); fclose(new_file); return 0;} /** * @brief Actually the only is to hide this main on a define