feat(Grace): adding the 3rd define
This commit is contained in:
parent
4fb3dac7f3
commit
d36e5ddf1d
1 changed files with 4 additions and 2 deletions
|
|
@ -1,7 +1,9 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define TO_WRITE "#include <stdio.h>%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 <stdio.h>%1$c#include <stdlib.h>%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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue