Skip to content

My ft_printf project for the 42 Cursus. A recreation of the printf function found in the <stdio.h> C Library. Bonuses in progress. 100/100

Notifications You must be signed in to change notification settings

lachlanstephen/ft_printf_42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

ft_printf

Mark: 100/100

Note: I'm currently working on the bonuses, so this repo wouldn't be able to be submitted as is.

ft_printf, one of three projects in Ring 1 of the 42 Cursus, introduced us to the idea of variadic functions: functions that take in a variable amount of arguments. Our task was to write a library that contains a recreation of printf from <stdio.h> in the Standard C Library.

Mandatory requirements:

  • Don't implement original printf buffer management
  • Handle the conversions cspdiuxX%
  • Output will be compared to original printf()

Bonus requirements:

  • Manage a combination of the flags -0. and field minimum width
  • Manage flags # + (one is a space)

Testing ft_printf functions

To test your own ft_printf, download main.c and testing_Makefile files from my repo, and move into your ft_printf project folder.

Run these commands to test your ft_printf functionality:

# Make using the specific Makefile with the -f flag

make re -f testing_Makefile

# Run compiled program

./test_printf

Compare the user output with the expected output.

Important: Make sure to run make fclean -f testing_Makefile to clean up files before submitting for evaluation.

To change the specifier my program tests:

  1. Edit the int main(void) function in main.c
  2. Comment out the currently active tests (with //)
  3. Uncomment desired test and recompile as above

Future Use of ft_printf

ft_printf can be added to your libft project folder to be used in future projects

Plan for repository

  • Complete bonus flag functionality
  • Create test function for bonus flags
  • Re-evaluate project with bonuses
  • Return whether diff of output is same or different from expected