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

https://github.com/keremozcn/ft_printf

The ft_printf project aims to reimplement the standard printf function in C. This project seeks to replicate various formatting options and behaviors of the printf function, providing a customizable and in-depth version to enhance understanding.
https://github.com/keremozcn/ft_printf

42 42born2code 42projects c

Last synced: 4 months ago
JSON representation

The ft_printf project aims to reimplement the standard printf function in C. This project seeks to replicate various formatting options and behaviors of the printf function, providing a customizable and in-depth version to enhance understanding.

Awesome Lists containing this project

README

        







Linkedin

## Proje Açıklaması

`ft_printf` projesi, C dilindeki standart `printf` fonksiyonunun yeniden implementasyonunu amaçlayan bir çalışmadır. Proje, `printf` fonksiyonunun çeşitli formatlama seçeneklerini ve davranışlarını simüle ederek, özelleştirilebilir ve daha derinlemesine anlaşılabilecek bir versiyonunu geliştirmeyi hedefler.

[Click here for the English version](README_EN.md)

## Dosya Yapısı

- `ft_printf.c`: `ft_printf` fonksiyonunun temel implementasyonunu içerir.
- `ft_printf_utils.c`: Yardımcı fonksiyonların implementasyonlarını içerir.
- `ft_printf.h`: Temel fonksiyon prototiplerini ve makro tanımlamalarını içerir.

## Kullanım

### Derleme

Projeyi derlemek için aşağıdaki komutları kullanabilirsiniz:

```bash
gcc -Wall -Wextra -Werror -c ft_printf.c ft_printf_utils.c
gcc -o ft_printf ft_printf.o ft_printf_utils.o
```

### Kullanım Örneği

```c
#include "ft_printf.h"

int main(void)
{
ft_printf("Hello, %s! You have %d new messages.\n", "Kerem", 5);
return (0);
}
```

Bu kod, konsola şu sonucu yazdırır:

```
Hello, Kerem! You have 5 new messages.
```

## Fonksiyon Prototipi

```c
int ft_printf(const char *format, ...);
```

### Parametreler
- `format`: Formatlama dizesi, yazı ve formatlama seçeneklerini tanımlar.
- `...`: Değişken sayıda argüman, formatlama seçeneklerine uygun değerleri belirtir.

### Dönüş Değeri
- Yazılan karakter sayısını döner.
- Bir hata durumunda negatif bir değer döner.

## Desteklenen Formatlar

`ft_printf` şunları destekler:
- `%c`: Tek bir karakter.
- `%s`: Null-terminated bir dizgi.
- `%d` veya `%i`: Onluk tam sayı.
- `%u`: Pozitif onluk tam sayı.
- `%x` veya `%X`: Onaltılık tam sayı (küçük/büyük harflerle).
- `%%`: Yüzde işareti.

## Katkı

Katkıda bulunmak için lütfen bir "pull request" oluşturup projenizi paylaşın. Her türlü katkı ve geribildirim memnuniyetle karşılanır.