Code Monkey home page Code Monkey logo

printf's Introduction

Description

_printf is our custom implementation of the C printf program function . It produces an output according to format described. It writes to stdout (standard output stream).

Environment

_printf has been tested on Ubuntu 14.04.6 and 18.04.3 LTS Done and tested with VirtualBox on Ubuntu via Vagrant(2.2.10)

Usage

String

  • Specifier: %s
  • Input: len = _printf("I am a string. \n");
  • Output: I am a string

Character

  • Specifier: %c
  • Input: _printf("char: %c\n", 'A');
  • Output: char: A

Integer

  • Specifier: %i
  • Input: `_printf("Length: %i\n", len);
  • Output: Length: 16

Decimal:

  • Specifier: %d
  • Input: _printf("%d\n", 1000);
  • Output: 1000

Unsigned Integer:

  • Specifier: %u
  • Input: unsigned int ui = (unsigned int)INT_MAX + 1024; _printf("Unsigned:[%u]\n", ui);
  • Output: Unsigned:[2147484671]

Octal:

  • Specifier: %o
  • Input: _printf("Unsigned octal:[%o]\n", ui);
  • Output: Unsigned octal:[20000001777]

Hexadecimal:

  • Specifier: %x lowercase %X UPPERCASE
  • Input: _printf("Unsigned hexadecimal:[%x, %X]\n", ui, ui);
  • Output: Unsigned hexadecimal:[800003ff, 800003FF]

Main Functionality

  • Produces output with (printf) conversion specifiers c, s, and %.
  • Handles conversion specifiers d, i.
  • man page added.

Advanced Functionality

  • Handles conversion specifier b.
  • Handles conversion specifiers u, o, x, X.
  • Uses a local buffer of 1024 chars in order to call write as little as possible.
  • Handles conversion specifier S.
  • Handles conversion specifier p.
  • Handles flag characters +, space, and # for non-custom conversion specifiers.
  • Handles length modifiers l and h for non-custom conversion specifiers.
  • Handles the field width for non-custom conversion specifiers.
  • Handles the precision for non-custom conversion specifiers.
  • Handles the 0 flag character for non-custom conversion specifiers.
  • Handles the custom conversion specifier r that prints the reversed string.
  • Handles the custom conversion specifier R that prints the rot13'ed string.
  • Ultimate goal: All above options working seamlessly together WORK IN PROGRESS.

Authors

Andres Lopez[email protected]

Daniel Cortes[email protected]

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.