Skip to content

mimicking the printf function in stdio library with set of flags "-0.# +"

Notifications You must be signed in to change notification settings

hboudar/42cursus-printf

Repository files navigation

📖 Ft_printf

printing data in the stdout

GitHub code size in bytes Code language count GitHub top language

📜 Table of Contents

💡 Mandatory Part with Bonus

This Function : is used to print formatted output in numerous ways to the standard output stdout.

Requirements

The function is written in C language and thus needs the gcc compiler and some standard C libraries.

Instructions

1. To use the function in your code, simply include a main() with its header:

#include "ft_printf.h"
int  main()
{
  ft_printf("%s\n", "hello world");
  return (0);
}

📋 Testing

Simply run this command (change X with the file of the main function):

make && gcc X

The Bonus

As a bonus to the Mandatory requirement, the function should :

  • Manage any combination of the following flags: ’-0.’ and the field minimum width under all conversions.
  • Manage all the following flags: ’# +’ (Yes, one of them is a space)

main example :

#include <stdio.h>

int main()
{
    printf("%-7d\n", 1337);
    printf("%07s\n", "1337");
    printf("%+7d\n", 1337);
    return 0;
}

Running :

./a.out | cat -e
1337   $
0001337$
  +1337$

About

mimicking the printf function in stdio library with set of flags "-0.# +"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published