ft_printf is a project from the 42 cursus that involves re-creating the C library function printf
. The main objective is to understand the inner workings of this essential function, including variadic functions, format specifiers, and buffer management. The project requires implementing a custom ft_printf
function that mimics the behavior of the standard printf
.
To compile and run the project, you will need:
- A Unix operating system (Linux or macOS).
- gcc or any C compiler.
- Make.
Clone the project repository and navigate to the main directory:
git clone https://github.com/PaLucena/ft_printf.git
cd ft_printf
Compile the project using the included Makefile:
make
This will generate the libftprintf.a
library in the current directory.
To use the ft_printf
function in your own project, include the libftprintf.a
library and the corresponding header file:
#include "ft_printf.h"
Link the library during the compilation of your project:
gcc -o your_program your_program.c -L. -lftprintf
The ft_printf function supports the following format specifiers:
%c
: Character%s
: String%p
: Pointer%d
: Decimal integer%i
: Integer%u
: Unsigned integer%x
: Hexadecimal integer (lowercase)%X
: Hexadecimal integer (uppercase)%%
: Percent sign
The project is organized into the following files and directories:
src/
: Contains the source code of theft_printf
implementation.include/
: Contains the header files.Makefile
: Build script to generate the library.README.md
: Project documentation.
This project is licensed under the MIT License. See the LICENSE
file for more details.