This repository hosts a re-implementation of the standard C library function printf
, known as ft_printf
. This project was developed as part of the programming training at School 42. The aim is to deepen knowledge of C programming by manually handling variadic functions and learning to precisely replicate standard library functionalities.
The ft_printf
function mimics the behavior of the original printf
, enabling formatted output by interpreting format specifiers embedded within strings. It handles a variety of format specifiers, including %s
for strings, %d
and %i
for signed integers, %u
for unsigned integers, %x
and %X
for hexadecimal numbers, %c
for characters, %p
for pointer addresses, and %%
for a literal percent sign.
- Mimics the standard
printf
function from the C Standard Library. - Supports multiple format specifiers.
- Error handling similar to
printf
, including returning the number of characters printed or a negative number if an error occurs.
- GCC compiler
- Standard C libraries
- Clone the repository:
git clone https://github.com/madvil2/ft_printf.git
- Navigate to the repository folder:
cd ft_printf
- Compile the library:
This will compile the library and create
make
ft_printf.a
.
To use ft_printf
in your C projects, include the header file and link against the compiled library.
- Include the header:
#include "ft_printf.h"
- Compile your project with
ft_printf
:gcc your_c_files.c -L. -lft_printf -o your_program_name
You can test the functionality of ft_printf
using third-party testers, such as:
Run the tester according to its documentation to ensure that all aspects of ft_printf
work correctly.
Contributions are welcome! Please feel free to submit a pull request or open an issue if you find bugs or have suggestions for improvements.
Distributed under the MIT License. See LICENSE
for more information.
Make sure to replace placeholder URLs and instructions according to your actual repository details and personal GitHub username. This structured README will help users and potential contributors understand and use your ft_printf
project effectively.