GithubHelp home page GithubHelp logo

abderrsfa / ft_printf Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 44 KB

Printf recoded. It manages width, precision, and the '0' '-' '*' flags.

License: Apache License 2.0

Makefile 4.93% C 95.07%
ft-printf libftprintf printf 1337 42born2code precision hexadecimal character

ft_printf's Introduction

๐Ÿ–จ ft_printf

๐Ÿง Description

The aim of this project is pretty straight forward; recode printf. This project teaches the ins and outs of using variadic arguments. The key to a successful ft_printf is well-structured and extensible code.

๐Ÿ”ง Usage

Running make will produce a library called ft_printf.a. Use ft_printf() just as you would use printf(). When compiling your code use ft_printf.a.

gcc main.c ft_printf.a

โš™๏ธ Functionality

Just like the real printf, ft_printf allows the following functionality:

%[flags][width][.precision]type

Flags:

These flags are supported:

  • '0' (zero) - if the 'width' option is specified, add zeros to the beginning for numeric types.

  • '-' (minus) - Left-align the output of this placeholder.

Width:

Specifies a minimum number of characters to output.

'*' : If '*' is used width is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted.

Precision:

Precision field specifies a maximum limit on the output. E.g: ft_printf("%.2s", "xyz"); would output 'xy'.

Type:

These conversion characters are managed:

  • %c (character)
  • %s (string)
  • %p (address)
  • %d (digit)
  • %i (integer)
  • %u (unsigned integer)
  • %x (hexadecimal in lowercase)
  • %X (hexadecimal in upper case)

ft_printf's People

Contributors

abderrsfa avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.