{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.
- Copy this repository inside a folder in your project directory.
- Include the
my.h
header file in your.c
files where you want to usemy_printf
:
#include "my.h"
- If you put this repository in a folder named
lib/
, run this command to compile amain.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.