项目作者: ronanboiteau

项目描述 :
{EPITECH.} Recoding libc's printf() & dprintf() functions, as well as a my_exit() function.
高级语言: C
项目地址: git://github.com/ronanboiteau/my_printf.git
创建时间: 2018-01-13T17:42:36Z
项目社区:https://github.com/ronanboiteau/my_printf

开源协议:

下载


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:
    1. #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:
    1. 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:

  1. int my_printf(const char *format, ...);

This function has the same behavior as libc’s printf().

  1. int my_dprintf(int fd, const char *format, ...);

This function has the same behavior as libc’s dprintf().

  1. 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.