add: readme
This commit is contained in:
parent
898be1619f
commit
a57e853516
60
README.md
Normal file
60
README.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# ft_printf
|
||||||
|
|
||||||
|
This is my implementation of the ft_printf project for the 42 school.
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
ft_printf is a function that replicates the functionality of the standard C printf function, allowing for formatted printing of strings and variables. The project requires the implementation of the ft_printf function in C, as well as the handling of a wide range of format specifiers and flags.
|
||||||
|
|
||||||
|
The project aims to develop students' understanding of variadic functions, formatting, and bit manipulation.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To use the ft_printf function, first compile the `libftprintf.a` library by running `make` in the root directory of the project.
|
||||||
|
|
||||||
|
Then, include the header file `ft_printf.h` in your C program and call the `ft_printf` function with the desired format string and arguments. For example: `ft_printf("Hello, %s!\n", "world");`.
|
||||||
|
|
||||||
|
The function will output the formatted string to the standard output.
|
||||||
|
|
||||||
|
## Supported Specifiers
|
||||||
|
|
||||||
|
The ft_printf function supports the following format specifiers:
|
||||||
|
|
||||||
|
| Specifier | Description |
|
||||||
|
| --------- | ----------- |
|
||||||
|
| `%c` | Character |
|
||||||
|
| `%s` | String |
|
||||||
|
| `%p` | Pointer |
|
||||||
|
| `%d` | Signed decimal integer |
|
||||||
|
| `%i` | Signed decimal integer |
|
||||||
|
| `%u` | Unsigned decimal integer |
|
||||||
|
| `%o` | Unsigned octal |
|
||||||
|
| `%x` | Unsigned hexadecimal (lowercase) |
|
||||||
|
| `%X` | Unsigned hexadecimal (uppercase) |
|
||||||
|
| `%%` | Literal `%` |
|
||||||
|
|
||||||
|
## Implementation Overview
|
||||||
|
|
||||||
|
The ft_printf function uses variadic arguments and a format string to output a formatted string to the standard output. The function first parses the format string to identify the format specifiers, then uses these to output the formatted string.
|
||||||
|
|
||||||
|
To parse the format string, the function iterates through each character in the string and performs the following actions:
|
||||||
|
|
||||||
|
if the character is not a format specifier, output it to the standard output.
|
||||||
|
|
||||||
|
To output the formatted string, the function uses a combination of standard C library functions and custom helper functions.
|
||||||
|
|
||||||
|
## Concepts Learned
|
||||||
|
|
||||||
|
Through the completion of this project, I gained knowledge and experience in the following areas:
|
||||||
|
|
||||||
|
- printf feature
|
||||||
|
- va_arg
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- ![The project subject](./subject.pdf)
|
||||||
|
- The C library documentation for the standard library functions used in the program
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
This project was created by Camille CHAUVET. If you have any questions or suggestions, feel free to contact me.
|
BIN
subject.pdf
Normal file
BIN
subject.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user