WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

hanmpark/ft_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

52 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ft_printf

A versatile and customizable formatted output function.


Repository created at Repository code size Mostly used language

πŸ“– Description

The ft_printf project reimplements the standard C printf function.

The goal is to create a function capable of formatting and printing different types of data, supporting multiple conversion specifiers, flags, and modifiers. This project deepens the understanding of variadic functions, parsing, and formatted output.

πŸ› οΈ Features

Function Prototype

int ft_printf(const char *, ...);

βœ… Supported Conversion Specifiers

  • %c – Character
  • %s – String
  • %p – Pointer address
  • %d / %i – Signed integers
  • %u – Unsigned integer
  • %x / %X – Hexadecimal (lowercase/uppercase)
  • %% – Percent sign

βš™οΈ Supported Flags

  • - (left align)
  • 0 (zero padding)
  • . (precision)
  • # (alternate form for hex)
  • + (force sign)
  • space (prepend a space for positive numbers)

πŸ“¦ Installation

Clone the repository and compile the library:

git clone https://github.com/hanmpark/ft_printf.git
cd ft_printf
make

This will create libftprintf.a which you can link into your projects.


πŸš€ Usage

Example usage:

#include "ft_printf.h"

int main(void)
{
    int count;

    count = ft_printf("Hello %s! Number: %d, Hex: %x\n", "world", 42, 42);
    ft_printf("Printed %d characters.\n", count);
    return (0);
}

Compile with:

gcc main.c -L. -lftprintf -I. -o my_program

πŸ‘€ Authors

About

A versatile and customizable formatted output function

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published