An open API service indexing awesome lists of open source software.

https://github.com/aabduvak/ft_printf

ft_printf (42cursus) 2022-2023. Remake printf. A project usefull for the next projects. The aim is to learn how variable size arguments works.
https://github.com/aabduvak/ft_printf

42 42born2code 42cursus 42istanbul 42projects 42school printf

Last synced: 24 days ago
JSON representation

ft_printf (42cursus) 2022-2023. Remake printf. A project usefull for the next projects. The aim is to learn how variable size arguments works.

Awesome Lists containing this project

README

          


đź§° ft_printf


Because putnbr and putstr aren’t enough


GitHub code size in bytes
Number of lines of code
Code language count
GitHub top language
GitHub last commit


About
·
Usage
·
Usefull Command
·
Testing

---

## đź’ˇ About the project

> _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._

### What is ft_printf?
ft_printf is an individual project at [42](https://www.42istanbul.com.tr/) that requires us to create a function similar to the printf from . The function ft_printf() (the name comes from “print formatted”) prints a string on the screen using a “format string” that includes the instructions to mix several strings and produce the final string to be printed on the screen.

### Application flow
Click [here](https://excalidraw.com/#json=X5IF2CEVuO8EhAyX9bwMZ,42SQg0D6nJcF7hwcDG1dVw) for the interactive link.

#### Objectives
- Unix logic

#### Skills
- Rigor
- Unix
- Algorithms & AI

#### My grade

## List of functions:

* [`ft_convert`](/sources/ft_convert.c) - converts num to related numerical base.
* [`ft_putnbr`](/sources/ft_putnbr.c) - prints the number on the screen.
* [`ft_putstr`](/sources/ft_putstr.c) - prints given string on the screen.
* [`ft_putchar`](/sources/ft_putstr.c) - prints given character on the screen.
* [`ft_putunbr`](/sources/ft_putunbr.c) - prints given number on the screen (only positive).
* [`ft_putptr`](/sources/ft_putptr.c) - prints given data by hexidecimal numerical base on the screen
* [`ft_strlen`](/sources/ft_strlen.c) - computes length of given string.
* [`ft_printf`](/sources/ft_printf.c) - prints a string on the screen using a “format string” that includes the instructions to mix several strings and produce the final string to be printed on the screen.

## 🛠️ Usage

**Follow the steps below**

### Instructions

**1. Clone the repository from github**

```bash
git clone https://github.com/abdulazizabduvakhobov/ft_printf && cd ft_printf/
```
**2. Compile the library by Makefile**
To compile the library, go to its path and run:

For all mandatory functions:

```bash
make
```

**3. Create main.c to test the funtion:**
```bash
touch main.c
```

**4. Using it in your code**

To use the function in your code, simply include its header:

```C
#include "ft_printf.h"
```

**Example of a main**
```C
#include "ft_printf.h"

int main(void)
{
ft_printf("%s", "Hello World");
ft_printf("%c", '\n');
ft_printf("%d", 123456789);
ft_printf("%c", '\n');
ft_printf("%X", 987654321);
return (0);
}

/**
* output:
* Hello World
* 123456789
* 3ADE68B1
**/
```

**5.After coding, you have to compile your code with libftprintf.a library like an example below**

```bash
gcc main.c libftprintf.a -I./sources && ./a.out
# Done :)
```

### Requirements

The library is written in C language and needs the **`gcc` compiler** and some standard **C libraries** to run.

## Usefull make command

**1. Cleaning all binary (.o) files**

To clean all files generated binary files while doing a make, go to the path and run:

```bash
make clean
```

**2. Cleaning all binary (.o) and executable files (.a)**

To clean all files generated while doing a make, go to the path and run:

```bash
make fclean
```

**2. Checking Norminette standart**

To check Norminette errors of all files, simply go to the path and run:

```bash
make norm
```

**3. Help command**

To get information about command, run:

```bash
make help
```

## đź“‹ Testing

You can use any of this third party testers to test the project

* [Tripouille/printfTester](https://github.com/Tripouille/printfTester)
* [paulo-santana/ft_printf_tester](https://github.com/paulo-santana/ft_printf_tester)