The custom printf function is an implementation of the widely used printf function in the C programming language. It provides a versatile and flexible way to format and print text output. This custom implementation aims to mimic the behavior and functionality of the standard C library's printf function while allowing for customization and extensibility.
Mayada Saeed - Maddily
- LinkedIn Profile
Sibongile Nhlema - Sibongile-Nhlema
- LinkedIn Profile
This task involves writing a function that produces output according to a format.
int _printf(const char *format, ...);
format
is a character string composed of zero or more directives.- The following conversion specifiers are to be handled:
c
s
%
- You don’t have to:
- Reproduce the buffer handling of the C library
printf
function - Handle the flag characters
- Handle field width
- Handle precision
- Handle the length modifiers
- Reproduce the buffer handling of the C library
This task involves handling the conversion specifiers d
and i
.
- You don’t have to:
- Handle the flag characters
- Handle field width
- Handle precision
- Handle the length modifiers
This task involves handling the following custom conversion specifier:
b
: the unsigned int argument is converted to binary
int main(void)
{
_printf("%b\n", 98); /*Output: 1100010*/
return (0);
}
This task involves handling the following conversion specifiers:
* u
* o
* x
* X
- You don’t have to:
- Handle the flag characters
- Handle field width
- Handle precision
- Handle the length modifiers
This task involves using a local buffer of 1024 chars in order to call write as little as possible.
This task involves handling the following custom conversion specifier:
S
: Prints a 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).
This task involves handling the p
conversion specifier.
- You don’t have to:
- Handle the flag characters
- Handle field width
- Handle precision
- Handle the length modifiers
This task involves handling the following flag characters for non-custom conversion specifiers:
+
- space
#
This task involves handling the following length modifiers for non-custom conversion specifiers:
l
h
d
i
u
o
x
X
This task involves handling the field width for non-custom conversion specifiers.
This task involves handling the precision for non-custom conversion specifiers.
This task involves handling the 0
flag character for non-custom conversion specifiers.
This task involves handling the -
flag character for non-custom conversion specifiers.
This task involves handling the following custom conversion specifier:
r
: prints the reversed string
This task involves handling the following custom conversion specifier:
R
: prints the rot13'ed string
This task involves making sure that all the above options work well together.