Skip to content

BryceKnight16/holbertonschool-printf

 
 

Repository files navigation

Printf Project

Welcome to our printf project done by the Holberton Students

giphy

Kathryn Kelly and Bryce Knight.
Team kat-and-myce.

Installation

To install this function yourself you are going to be cloning our repository by using the command git clone.

This is the full git clone command to clone our repository:
git clone https://github.com/Kathryn8/holbertonschool-printf.git

Makefile

Our repository contains a makefile, and with file it allows you to compile all of the our code to your own main.c with simple command make and when you do this it will create an executable called ./_printf

Example:
using the command make this will compile everything including your own main.c

./_printf is the executable that you will run to display the contains of your main.c when you use _printf

Example of your main.c:

#include "main.h"
int main()
{
   _printf("Hello World")
   return(1);
}

When you run ./_printf the outcome will be Hello world.

If you would like to use our testing main.c, then rename the local_testing file (found in the repository) to main.c.

To see the manual page for this function, type the following into the command line: man ./man_3_printf

Documentation

SYNOPSIS

Prototype:

int _printf(const char *format, ...);

DESCRIPTION

The _printf() function writes output to the standard output stream, according to the format specifiers inside the format string. The subsequent arguments are converted under the control of the format string and its format specifiers.

The format string is a string of characters that will all be printed sequentially except for when the following character combinations appear:

FORMAT SPECIFIERS

%c prints a char or character
%s prints a char * or pointer to an array of chars. The array must contain a terminating null byte (‘\0’), and the null byte is not included in the _printf output.
%i prints an int or integer
%d prints a decimal number or integer in base-10

FORMAT CONTROLS

%% prints a single %
\" double quote
\\ backslash
\a alert (BEL)
\b backspace
\n new line
\r carriage return
\t horizontal tab
\v vertical tab

This _printf function takes no flags and cannot handle field width, precision or length modifiers. The number of arguments following the format string must be equal or greater than the number of format specifiers in the format string.

RETURN VALUE

This function returns an integer value that is equal to the number of characters printed. If a string ends with % or the format string is NULL, the return value is -1.

Flowchart

Below is a flowchart showing the basic implementation of how our function works and the steps the function goes through to return the desired result.

image

AUTHORS

To contact the authors of this page and to review the _printf code or submit pull requests, please visit: https://github.com/Kathryn8/holbertonschool-printf
https://github.com/BryceKnight16/holbertonschool-printf

About

collaborative group project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 91.7%
  • Makefile 8.3%