Go to file
Camille Chauvet a57e853516 add: readme
2023-03-27 16:29:26 +02:00
ft_dprintarg.c final 2022-10-23 19:01:50 +02:00
ft_dprintflag.c final 2022-10-23 19:01:50 +02:00
ft_dprintl_base.c final 2022-10-23 19:01:50 +02:00
ft_dprintptr.c final 2022-10-23 19:01:50 +02:00
ft_dprintul_base.c final 2022-10-23 19:01:50 +02:00
ft_dprintul.c final 2022-10-23 19:01:50 +02:00
ft_dprintx.c final 2022-10-23 19:01:50 +02:00
ft_dprintX.c final 2022-10-23 19:01:50 +02:00
ft_isarg.c final 2022-10-23 19:01:50 +02:00
ft_isdigit.c final 2022-10-23 19:01:50 +02:00
ft_printf.c final 2022-10-23 19:01:50 +02:00
ft_printf.h kekw 2022-11-07 19:47:30 +01:00
ft_putchar_fd.c final 2022-10-23 19:01:50 +02:00
ft_putstr_fd.c final 2022-10-23 19:01:50 +02:00
ft_skipflag.c final 2022-10-23 19:01:50 +02:00
ft_strlen.c final 2022-10-23 19:01:50 +02:00
ft_vdprintf.c d 2022-12-11 19:27:25 +01:00
Makefile kekw 2022-12-07 16:20:42 +01:00
README.md add: readme 2023-03-27 16:29:26 +02:00
subject.pdf add: readme 2023-03-27 16:29:26 +02:00

ft_printf

This is my implementation of the ft_printf project for the 42 school.

Description

ft_printf is a function that replicates the functionality of the standard C printf function, allowing for formatted printing of strings and variables. The project requires the implementation of the ft_printf function in C, as well as the handling of a wide range of format specifiers and flags.

The project aims to develop students' understanding of variadic functions, formatting, and bit manipulation.

Usage

To use the ft_printf function, first compile the libftprintf.a library by running make in the root directory of the project.

Then, include the header file ft_printf.h in your C program and call the ft_printf function with the desired format string and arguments. For example: ft_printf("Hello, %s!\n", "world");.

The function will output the formatted string to the standard output.

Supported Specifiers

The ft_printf function supports the following format specifiers:

Specifier Description
%c Character
%s String
%p Pointer
%d Signed decimal integer
%i Signed decimal integer
%u Unsigned decimal integer
%o Unsigned octal
%x Unsigned hexadecimal (lowercase)
%X Unsigned hexadecimal (uppercase)
%% Literal %

Implementation Overview

The ft_printf function uses variadic arguments and a format string to output a formatted string to the standard output. The function first parses the format string to identify the format specifiers, then uses these to output the formatted string.

To parse the format string, the function iterates through each character in the string and performs the following actions:

if the character is not a format specifier, output it to the standard output.

To output the formatted string, the function uses a combination of standard C library functions and custom helper functions.

Concepts Learned

Through the completion of this project, I gained knowledge and experience in the following areas:

  • printf feature
  • va_arg

Resources

  • The project subject
  • The C library documentation for the standard library functions used in the program

Authors

This project was created by Camille CHAUVET. If you have any questions or suggestions, feel free to contact me.