Skip to content

Pour le projet ft_printf du cursus de l’école 42, nous devons recréer la célèbre fonction printf de la bibliothèque C. Ce projet nous enseigne sur les arguments variadiques ainsi que sur les structures si nous prévoyons d’implémenter les flags supplémentaires de printf.

Notifications You must be signed in to change notification settings

riceset/ft_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ft_printf

Summary

For the ft_printf project of the 42 school cursus, we must recreate the famous C library printf function. This project teaches us about variadic arguments as well as structures if we plan to implement printf's extra flags.

Getting started

First, clone this repository and cd into it:

$ git clone https://github.com/riceset/printf; cd ft_printf

Compile the library with:

$ make

Basic Usage

For example, let's create a main.c file.

// Include the header
#include "ft_printf.h"

int main(void)
{
      // Call the function
      ft_printf("Hello %d!", 1);
      return (0);
}

Compile the main.c file with the ft_printf library and run the program:

gcc main.c libftprintf.a && ./a.out

Output should be:

Hello 1!

Caveats

This version of printf() only supports the following conversions:

Specifiers

Format Specifier Description
% % followed by another % character writes % to the screen.
c writes a single character.
s writes a character string.
p writes an implementation-defined character sequence defining a pointer address.
d or i writes a signed integer to decimal representation.
u writes an unsigned integer to decimal representation.
x or X writes an unsigned integer to hexadecimal representation.

About

Pour le projet ft_printf du cursus de l’école 42, nous devons recréer la célèbre fonction printf de la bibliothèque C. Ce projet nous enseigne sur les arguments variadiques ainsi que sur les structures si nous prévoyons d’implémenter les flags supplémentaires de printf.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published