Portfolio

own printf shell function

En este proyecto programamos desde cero una función igual a printf() en C. La función permite imprimir de acuerdo a los especificadores de formato de tal forma que puede imprimir caracteres, strings, números positivos y negativos, en hexadecimal, binario, octal y direcciones de memoria entre otros.

Demo: https://nulltagram.herokuapp.com/

stack

printf app

User Guide

_printf project

Description

In _printf project we code from zero our own custom printf function. Native printf function allows you to print with certain formats. We handle most basic format so you can print chars, strings, positive and negative numbers, hex, octa and binary numbers among other formats. You can see man 3 of printf to understand how printf works.

Usage

Compile

gcc -Wall -Werror -Wextra -pedantic *.c -o executable

Prototype

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

Return

If everything is successful, the function returns the num of chars printed.

Format conversion

FormatDescription
cPrint char values
sPrint strings
d, iPrint numbers [positive and negative]
bPrint nums converted to binary
uPrint nums as unsigned int
oPrint nums converted to octal
xPrint nums converted to hexa [uppercase]
XPrint nums converted to hexa [uppercase]
%%Print % character
pPrint memory adress [pointers]
rPrint string in reverse
SPrint string and non-printable chars [\x + ASCII value in hexa]
RPrint in rot13