Skip to content

kellyhayd/ft_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📝 ft_printf

Static Badge Static Badge Static Badge

This project is about recoding the printf() function from libc.

✏ About

A recreation of the printf() function from libc, handling various conversion specifiers and flags,
ensuring smooth display management and error handling.

⚙ Requirements

  • The project must be written in C.
  • Buffer management of the original printf() should not be implemented.
  • The function must handle the following conversions: cspdiuxX%:
    • %c Prints a single character.
    • %s Prints a string (as defined by the common C convention).
    • %p The void * pointer argument has to be printed in hexadecimal format.
    • %d Prints a decimal (base 10) number.
    • %i Prints an integer in base 10.
    • %u Prints an unsigned decimal (base 10) number.
    • %x Prints a number in hexadecimal (base 16) lowercase format.
    • %X Prints a number in hexadecimal (base 16) uppercase format.
    • %% Prints a percent sign.
  • The implemented function will be compared against the original printf().
  • The ar command must be used to create the library. Using the libtool command is forbidden.
  • The resulting libftprintf.a library must be created at the root of the repository.

📝 Instructions

  • The function ft_printf should have the following prototype: int ft_printf(const char *, ...).
  • The function should return the number of characters printed (excluding the null byte used to end output to strings).
  • The function should handle the conversion specifiers listed in the requirements.
  • All necessary memory allocation must be handled appropriately, and memory leaks should be avoided.

🪛 Approach

The function ft_printf will parse the format string and handle each conversion specifier accordingly. It will format and output the data as specified by the format string.

🌟 Bonus Part

⭐ Requirements

* Manage any combination of the following flags: `-0.` and the field minimum width under all conversions. * Manage all the following flags: `# +` (Yes, one of them is a space)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published