Skip to content

Adri11334/my_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Epitech Project 2021
B1 - Unix System Programming
B-PSU-100

{EPITECH} - my_printf

printf command-like

Coding Style

  • style mark: ?
  • style major: 1
  • style minor: 3
  • style info: 0

Note : 54.2%

  • 01: 8/8
  • 02: 13/13
  • 03: 5/6
  • 04: 0/9
  • 05: 0/6
  • 06: 0/6

Coverage: 98%


Content

binary name: libmy.a
language: C
build tool: via Makefile, including re, all, clean, fclean [my_tests, tests_run, cover, tests_file] rules


Goal

You must recode the printf function from the C library according to the C99 standard. Your function should be prototyped like the printf function.
You do not have to implement the C library printf buffer handling.
You must process all printf formating flags except the following (which are optional):

  • float or double types management,
  • %n flag management,
  • " * " , " ’ " and " I " (capital i) flags management.

You must add a %b formating flag, which prints unsigned numbers in a binary base.
You must also add a %S formating flag, which prints a character string (like %s). However, non-printable characters (ASCII value strictly smaller than 32 or greater or equal than 127) must be represented by a back- slash to be followed by the character’s value in octal base.


Unit tests

#include <criterion/criterion.h>
#include <criterion/redirect.h>
#include "my.h"

void redirect_all_std(void)
{
  cr_redirect_stdout();
  cr_redirect_stderr();
}

Test (my_printf, simple_string, .init=redirect_all_std)
{
  my_printf("hello world");
  cr_assert_stdout_eq_str("hello world");
}

Examples

char str[5];

my_strcpy(str, "toto");
str[1] = 6;
my_printf("%S\n", str);
~/B-PSU-100> ./a.out
t\006to
~/B-PSU-100>

  • Student: Adrien VERMERSCH
  • Email: [email protected]
  • Year: 2021
  • Promotion: 2026
  • Campus: Bordeaux

Code rédigé selon la norme Epitech (promo 2026).

Recopier ce repo revient au vol de code.
Autrement dit, -42

About

Epitech Project, my_printf

Resources

Stars

Watchers

Forks