Skip to content

This is the printf project for Holberton School Cohort 14's Foundation program

Notifications You must be signed in to change notification settings

AlfredPianist/printf

Repository files navigation

_printf

This _printf project is about building a function as similar as possible to the original printf.

Features

  • The main function uses structures to call the function corresponding to the case.
  • The function has a buffer that stores and prints the output strings every 1024 bytes just like the original printf.
  • The returns of our function are the number of characters printed, and when there's an incorrect input the return is going to be -1 as an error, just like the original printf.

Files and Descriptions

FILE DESCRIPTION
_printf Function that prints like printf
holberton.h Header file that contains our prototypes and includes.
get_format Chooses the format to be used.
formats.c Contains main function formats to print: %c, %s, '%', %d.
formats_advanced_1.c Contains %R format specifier to encode to rot13, and %r to reverse a string
formats_advanced_2.c Contains advanced function formats to print: %b, %u, %o, %X, %x
_string.c Concatenates a string to the buffer to print the strings you want.
memory.c Checks size of buffer and allocates memory to be printed
utilities.c Contains: _itoa, _uitoa_b_o_h, rev_string, and rot13 functions
man_3_printf Our manual with documentation about the function _printf

Flowchart of main functions implementation:

_printf.c

_printf

get_format.c

get_format.c

formats.c

formats.c

_string.c

string.c

memory.c

memory.c

utilities.c

utilities.c

Session log:

12/02/21

Session 0 (12/03/21 - Duration: 3:35, from 18:34 to 22:09)
  • Planned modules for printf (Miro).
  • First draft of flowchart.
  • Proof of concept for task 1 (basic printf with `%c`, `%s` and `%%`).
Tomorrow
  • Function pointers for proof of concept.
  • Structure for printf's modules.

13/03/21

Session 1 (Duration: 3:08, from 10:52 to 14:00)
  • Function pointers implementation of proof of concept for task 1.
Next session:
  • Edge cases for printf's function pointer implementation.
  • Implementation of %d and %i.
  • Buffer allocation.
Session 2 (Duration: 4:56, from 17:36 to 22:32)
  • Edge cases for printf's function pointer implementation.
  • Implementation of %d and %i.
Next session:
  • Buffer allocation.
Session 3 (Duration: 4:56, from 23:18 to +1 01:03)
  • Buffer allocation.
Tomorrow:
  • Planning for split work, implementation of other formats.
Session 4 (Duration: 03:10, from 16:14 to 19:25)
Session 5 (Duration: 02:54 , from 20:33 to 23:27)
  • Discussion about flags, width and precision
  • Implementation of strconcat
Tomorrow:
  • Plan how to implement more than two characters after the format %
  • Alfredo will work in: %b, %X, %x, %R
  • Daniel will work in %u, %o, %r

About

This is the printf project for Holberton School Cohort 14's Foundation program

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages