This project is a custom implementation of the _printf function, which mimics the behavior of the standard C library function printf. The collaborators on this project are MinightDev and SoufianeAziz.
- functions.c: Contains functions to handle printing of various data types, such as strings, integers, hexadecimals, octals, addresses, and binary.
- main.h: Header file containing function prototypes and necessary includes.
- _printf.c: The main implementation of the custom
_printffunction. - handlers.c: Contains helper functions to handle different conversion specifiers for custom functionality like ROT13 encryption, binary printing, reversed string printing, etc.
- testing/main.c: A test program to demonstrate the functionality of the custom
_printffunction.
The custom _printf function supports the following conversion specifiers:
%c: For printing characters.%s: For printing strings.%dand%i: For printing signed integers.%u: For printing unsigned integers.%xand%X: For printing hexadecimal numbers (lowercase and uppercase, respectively).%o: For printing octal numbers.%p: For printing addresses.%b: For printing binary representation of unsigned integers.%S: For printing strings with special handling for non-printable characters (replaced with hexadecimal escape sequences).%r: For printing strings in reverse.%R: For printing strings with ROT13 encryption.
- Include the
"main.h"header in your source file. - Call the
_printffunction with the desired format string and any additional arguments corresponding to the format specifiers.
#include "main.h"
int main(void)
{
_printf("Hello, %s! This is a test program.\n", "Developer");
_printf("Decimal: %d, Hexadecimal: %x\n", 123, 123);
_printf("Address: %p\n", (void *)0x7ffe637541f0);
_printf("Binary: %b\n", 10);
_printf("Non-printable: %S\n", "Best\nSchool");
_printf("Reversed: %r\n", "Hello");
_printf("ROT13: %R\n", "Hello world");
return (0);
}- MinightDev
- SoufianeAziz
For any issues or improvements, feel free to contact the collaborators. Happy coding!