Skip to content

Building the glibc printf() function from scratch that handles char, int, string, and decimal (for now)

License

Notifications You must be signed in to change notification settings

ConnorBrereton/printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔄 🔧 printf()

_printf() is a rebuild of the GNU print() out of the standard C library. This build is ISO compliant due to compilation from the C90 compiler.

🏃 Getting Started

⚠️ Prerequisites

  • Must have git installed

  • Must have repository cloned

$ sudo apt-get install git

⬇️ Installing

Clone the repository

$ git clone https://github.com/ConnorBrereton/printf.git

Include in header file

#include "holberton.h"

📑 Features

  • %c : with the char argument, prints that char

  • %s : with the string argument, prints that string

  • %d : with the integer argument, prints that integer

  • %i : with the integer argument, prints that integer

  • %% : will escape the %, prints that character

📋 Examples

_printf("A char inside a sentence: %c. Did it work?\n", 'F');

<output>  A char inside a sentence: F. Did it work?



_printf("Complete the sentence: You %s nothing, Jon Snow.\n", (char *)0);

<output> Complete the sentence: You (nil) nothing, Jon Snow.



_printf("Negative:[%d]\n", -762534);

<output> Negative:[-762534]



len = _printf("Let's try to printf a simple sentence.\n");
len2 = printf("Let's try to printf a simple sentence.\n");

_printf("Length:[%d, %i]\n", len, len);

<output> Length:[39, 39]


_printf("%s%c%c%c%s%%%s%c", "Loading ", '.', '.', '.', " 99", " Please wait", '\n');

<output> Loading ... 99% Please wait

📚 Coding Style Tests

Strictly followed Betty style guide. To install

$ git clone https://github.com/holbertonschool/Betty.git

$ cd Betty; ./install.sh

📝 Version

  • 0.1.0

📘 Authors

🔍 License

This project is licensed under the MIT License - see the LICENSE.md file for details

📣 Acknowledgments

  • Carlos Chan
  • Holberton School
  • Stack Overflow

About

Building the glibc printf() function from scratch that handles char, int, string, and decimal (for now)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages