Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/badreddinkaztaoui/fq_printf
Printf project from 42 Network
https://github.com/badreddinkaztaoui/fq_printf
1337school 42school c c-language printf printf-42
Last synced: 19 days ago
JSON representation
Printf project from 42 Network
- Host: GitHub
- URL: https://github.com/badreddinkaztaoui/fq_printf
- Owner: badreddinkaztaoui
- Created: 2023-05-02T09:10:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-02T11:16:35.000Z (over 1 year ago)
- Last Synced: 2024-11-10T21:36:02.991Z (3 months ago)
- Topics: 1337school, 42school, c, c-language, printf, printf-42
- Language: C
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ft_printf
`ft_printf` is a custom implementation of the C standard library function `printf`. It allows you to format and print text to the console or a file using a variety of format specifiers.
## Table of Contents
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Function Documentation](#function-documentation)
- [Contributing](#contributing)
- [License](#license)## Getting Started
To use `ft_printf`, you'll need to download the source code and compile it into a library. Here's how to get started:
1. Clone the repository: `git clone https://github.com/badreddinkaztaoui/ft_printf.git`
2. Compile the library: `make`
3. Link the library to your project: `-L/path/to/libftprintf.a`## Usage
Once you've linked the library to your project, you can use `ft_printf` just like you would use `printf`. Here are some examples of how to use `ft_printf`:
```c
#include "ft_printf.h"int main() {
int num = 42;
char str[] = "hello";ft_printf("The answer is %d\n", num);
ft_printf("The string is %s\n", str);return 0;
}
```This will output:
```
The answer is 42
The string is hello
````ft_printf` supports a variety of format specifiers, including `%d` for integers, `%s` for strings, `%c` for characters, `%p` for pointers, `%f` for floating-point numbers, and more. See the [Function Documentation](#function-documentation) section for a full list of format specifiers.
## Function Documentation
`ft_printf` consists of several functions that work together to format and print text. Here's a brief overview of each function:
- `ft_printf`: The main function that prints formatted text to the console or a file. It takes a format string and a variable number of arguments, and returns the number of characters printed.
- `ft_printres`: A helper function that parses the format string and extracts any formatting flags, such as the minimum field width or precision.
- `ft_putchar_len`: A helper function that prints a single character.
- `ft_putstr_len`: A helper function that prints a null-terminated string.
- `ft_putnbr_len`: A helper function that prints a decimal integer.
- `ft_putunbr_len`: A helper function that prints an unsigned decimal integer.
- `ft_puthexa`: A helper function that prints a hexadecimal integer.
- `ft_putadress`: A helper function that prints a memory address as a hexadecimal integer.
- `ft_str`: A helper function that takes a string as argument and return his length.
See the [ft_printf.h](https://github.com/badreddinkaztaoui/ft_printf/blob/main/ft_printf.h) header file for a full list of functions and their parameters.
## Contributing
If you'd like to contribute to `ft_printf`, you can open a pull request on GitHub. Please make sure your code follows the [Coding Standards](https://github.com/badreddinkaztaoui/ft_printf/blob/master/docs/coding_standards.md) and includes tests for any new features or bug fixes.
## License
`ft_printf` is released under the [MIT License](https://github.com/badreddinkaztaoui/ft_printf/blob/master/LICENSE).