Skip to content
Iva edited this page Sep 27, 2024 · 3 revisions

Modified Libft Functions

Some existing functions in libft have been modified to address specific requirements of this project.
These updates provide additional functionality or control over the output process.
Below are the modified functions and the reasons for their changes.

ft_putchar_v2

Operates similarly to the original libc function, writing the character c, but in addition it returns the number of characters written. Unlike ft_putchar_fd, which requires two parameters, ft_putchar_v2 simplifies the process with just one, as it always directs output to STDOUT by default.

Project Signature
Libft void ft_putchar_fd(char c, int fd)
ft_Printf int ft_putchar_v2(char c)

ft_putstr_v2

Similar principles as their original libc, outputs the string s, but in addition it returns the number of characters printed. Unlike ft_putstr_fd, which requires two parameters, ft_putstr_v2 simplifies the process with just one, as it always directs output to STDOUT by default.

Project Signature
Libft void ft_putstr_fd(char *s, int fd)
ft_Printf int ft_putstr_v2(char *s)

ft_putnbr_v2

Similar principles as their original libc, prints the integer n, but in addition it returns the number of characters printed. Unlike ft_putnbr_fd, which requires two parameters, ft_putnbr_v2 simplifies the process with just one, as it always directs output to STDOUT by default.

Project Signature
Libft void ft_putnbr_fd(int n, int fd
ft_Printf int ft_putnbr_v2(int n)

Since the original printf function returns the number of characters printed, updating the utility functions in libft to include this feature is a simple and efficient way to wrap existing functionality.
This modification allows these utility functions to provide additional control, making them more versatile while maintaining the simplicity of their core behavior.

Previous ⬅️ Top ⬆️ Next ➡️

Clone this wiki locally