ronanboiteau / my_printf

{EPITECH.} Recoding libc's printf() & dprintf() functions, as well as a my_exit() function.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

my_printf

{EPITECH.} first year project.

Recoding libc's printf() & dprintf() functions, as well as a my_exit() function.

Requirements

Get started

Compile the library

Navigate to the root of the repository from your Terminal and run make to build the libmy.a static library.

Use my_printf

  • Copy this repository inside a folder in your project directory.
  • Include the my.h header file in your .c files where you want to use my_printf:
#include "my.h"
  • If you put this repository in a folder named lib/, run this command to compile a main.c file using the library:
gcc main.c -L lib/ -l my -I lib/include/

Functions

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.

About

{EPITECH.} Recoding libc's printf() & dprintf() functions, as well as a my_exit() function.


Languages

Language:C 95.3%Language:Makefile 4.7%