The printf function sends formatted output to stdout. A custom _printf() for learning purposes was developed by cohort #8 students Nicks and Musa parsanka. _printf() function format string is a character string, beginning and ending in its initial shift state, if any. These arguments are placed using the percentage '%' operator
write (man 2 write) malloc (man 3 malloc) free (man 3 free) va_start (man 3 va_start) va_end (man 3 va_end) va_copy (man 3 va_copy) va_arg (man 3 va_arg)
The code must be compiled this way:
*$ gcc -Wall -Werror -Wextra -pedantic .c
As a consequence, be careful not to push any c file containing a main function in the root directory of your project (you could have a test folder containing all your tests files including main functions)
The main files will include your main header file (main.h): #include main.h
Write a function that produces output according to a format. Handle the following conversion specifiers:
- c
- s
- %
Handle the following conversion specifiers:
- d
- i
Create a man page for the function
Handle the following conversion specifiers:
- b
Handle the following conversion specifiers:
- u
- x
- o
- x
- X
Use a local buffer of 1024 chars in order to call write as little as possible.
- S : prints the string.
- Non printable characters (0 < ASCII value < 32 or >= 127) are printed this way: \x, followed by the ASCII code value in hexadecimal (upper case - always 2 characters).
Handle the following conversion specifier: p
Handle the following flag characters for non-custom conversion specifiers:
- ´+´
- space
- ´#´
Handle the following length modifiers for non-custom conversion specifiers:
- l
- h Conversion specifiers to handle: d, i, u, o, x, X
Handle the field width for non-custom conversion specifiers.
Handle the precision for non-custom conversion specifiers.
Handle the 0 flag character for non-custom conversion specifiers.
Handle the - flag character for non-custom conversion specifiers.
Handle the following custom conversion specifier:
- r : prints the reversed string
Handle the following custom conversion specifier:
- R: prints the rot13'ed string
All the above options work well together.
-
Ekrika
-
Ridwan
-
Signed by both