{EPITECH.} Recoding libc's printf() & dprintf() functions, as well as a my_exit() function.
{EPITECH.} first year project.
Recoding libc’s printf()
& dprintf()
functions, as well as a my_exit()
function.
Navigate to the root of the repository from your Terminal and run make
to build the libmy.a
static library.
my.h
header file in your .c
files where you want to use my_printf
:
#include "my.h"
lib/
, run this command to compile a main.c
file using the library:
gcc main.c -L lib/ -l my -I lib/include/
Here is a list of the functions you will find in the libmy.a
library:
int my_printf(const char *format, ...);
This function has the same behavior as libc’s printf()
.
int my_dprintf(int fd, const char *format, ...);
This function has the same behavior as libc’s dprintf()
.
void my_exit(int exit_code, const char *format, ...);
This function has the same behavior as libc’s printf()
. Except it outputs on stderr
) & it takes an exit status as first argument. After my_exit()
is done printing, it will call libc’s exit()
to quit your program with the exit status you gave as an argument.