https://github.com/achrafelkhnissi/ft_printf
The goal of this project is pretty straightforward. Is an implementation of printf().
https://github.com/achrafelkhnissi/ft_printf
1337school 42cursus 42projects 42school printf-42
Last synced: 7 months ago
JSON representation
The goal of this project is pretty straightforward. Is an implementation of printf().
- Host: GitHub
- URL: https://github.com/achrafelkhnissi/ft_printf
- Owner: achrafelkhnissi
- Created: 2022-06-02T16:54:10.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-28T02:11:36.000Z (about 3 years ago)
- Last Synced: 2025-01-17T07:47:24.493Z (9 months ago)
- Topics: 1337school, 42cursus, 42projects, 42school, printf-42
- Language: C
- Homepage: https://www.linkedin.com/in/achrafelkhnissi/
- Size: 6.84 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
42cursus' ft_printf
Development repo for 42cursus' ft_printf project
For further information about 42cursus and its projects, please refer to 42cursus repo.
About
·
Usage
·
Useful Links---
## 🗣️ About
> _This project is pretty straight forward. You will recode printf. Hopefully you will be able to reuse it in future project without the fear of being flagged as a cheater. You will mainly learn how to use variadic arguments._
🚀 TLDR: this project consists of coding a library that contains a simplified version (more
information below) of the printf function.### Mandatory
* **format specifiers** - `cspdiuxX%`
## 🛠️ Usage
### Requirements
The library is written in C language and thus needs the **`gcc` compiler** and some standard **C libraries** to run.
### Instructions
**1. Compiling the library**
To compile the library, run:
```shell
$ cd path/to/ft_printf && make
```**2. Using it in your code**
To use the library functions in your code, simply include its header:
```C
#include "ft_printf.h"
```and, when compiling your code, add the required flags:
```shell
-lftprintf -L path/to/libftprintf.a -I path/to/ft_printf.h
```### Third-party testers
* [printfTester](https://github.com/Tripouille/printfTester)
* [gavinfielder/pft](https://github.com/gavinfielder/pft)
* [Mazoise/42TESTERS-PRINTF](https://github.com/Mazoise/42TESTERS-PRINTF)
* [HappyTramp/ft_printf_test](https://github.com/HappyTramp/ft_printf_test)
* [t0mm4rx/ftprintfdestructor](https://github.com/t0mm4rx/ftprintfdestructor)
* [charMstr/printf_lover_v2](https://github.com/charMstr/printf_lover_v2)## 📌 Useful Links
* [C++ Reference - printf](http://www.cplusplus.com/reference/cstdio/printf/)
* [Article: Secrets of “printf” (PDF)](https://www.cypress.com/file/54441/download)
* [MacOS documentation - printf](https://opensource.apple.com/source/xnu/xnu-201/osfmk/kern/printf.c.auto.html)
* [IEEE-754 Floating Point Converter](https://www.h-schmidt.net/FloatConverter/IEEE754.html)
* [How does one print floats for ft_printf? - Stack Overflow - 42 Network](https://stackoverflow.com/c/42network/questions/133/134#134)
* [Printing Floating-Point Numbers](http://www.ryanjuckett.com/programming/printing-floating-point-numbers/)
* [Printing Floating-Point Numbers Quickly and Accurately with Integers](https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf)
* [What precisely does the %g printf specifier mean? - Stack Overflow](https://stackoverflow.com/questions/54162152/what-precisely-does-the-g-printf-specifier-mean)## Notes
1. What is Variadic Functions?
- Variadic function takes indefinite size arity and a variable number of arguments as a parameter. Situations that you do not know how many parameters pass the function.
2. what is ellipses (...)?
- The ellipsis (...) is part of the C language and indicates that there are 0 or more optional arguments.
2. What is va_list?
-
3. What is va_start?
- gets the address of the first argument.
4. What is va_arg?
- dereference the block address and type cast it to the appropriate type. then goes to the next block of memory.
- What is a "Type Descriptor"?
5. What is va_end?
-
6. Calling convensions!
- https://www.youtube.com/watch?v=JHGTXM3oIs0
- https://en.wikipedia.org/wiki/X86_calling_conventions
- https://www.youtube.com/watch?v=F3XiH78erNM&t=1615s
## notes
- man stdarg