Giter VIP home page Giter VIP logo

ft_printf's Introduction

FT_PRINTF

Mandatory part:

  • Manage the following conversions: s, p, d, i, o, u, x, X & c
  • Manage %%
  • Manage the flags #, 0, -, + & space
  • Manage the minimum field-width
  • Manage the precision
  • Manage the flags hh, h, l, ll, & L.

Flags:

\#0-+ and space
- Left-justify within the given field width; Right justification is the default (see width sub-specifier).
+ Forces to preceed the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign.
(space) If no sign is going to be written, a blank space is inserted before the value.
# Used with o, x or X specifiers the value is preceeded with 0, 0x or 0X respectively for values different than zero. Used with a, A, e, E, f, F, g or G it forces the written output to contain a decimal point even if no more digits follow. By default, if no digits follow, no decimal point is written.
0 Left-pads the number with zeroes (0) instead of spaces when padding is specified (see width sub-specifier).

Length sub-specifier:

length d i u o x X f F e E g G a A c s p
none int unsigned int double int char* void*
hh signed char unsigned char
h short int unsigned short int
l long int unsigned long int wint_t wchar_t*
ll long long int unsigned long long int
j intmax_t uintmax_t
z size_t size_t
L long double

Bonuses:

  • '*' flag

  • '%k' - prints current date

  • '%t' - printf current time

Links:

1. https://stackoverflow.com/questions/1449805/how-to-format-a-number-from-1123456789-to-1-123-456-789-in-c
  1. http://www.cplusplus.com/reference/cstdio/printf/

  2. https://linux.die.net/man/3/stdarg

ft_printf's People

Contributors

kohelbekker avatar

Watchers

James Cloos avatar  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.