Skip to content

Other useful utils

Ilya Kashnitskiy edited this page Feb 17, 2020 · 5 revisions
  • gnl

ft_get_next_line.h ft_get_next_line.c

Separate school 42 project.

Сlone standard getline() from libc.

  • fast_input_gnl

ft_fast_input_gnl.h ft_fast_input_gnl.c

Implementation of gnl for read from stdin only and with high performance!

  • ft_printf

ft_printf.h prf_includes printf_src

Separate school 42 project.

The following functionality is implemented:

  • %%
  • standart qualifiers (%): c,s,p
  • standart qualifiers (%): i,d,u,o,x,X with flags: l,ll,h,hh
  • standart qualifiers (%): f,e,E with flags: l,L
  • manage the flags #0-+ and space
  • manage the minimum field-width
  • manage the manage the precision
  • detailed flags management: *, $ and ’

$ doesn't work with long double if it is not in the last place.

  • additional qualifiers (%): b (for binary output), w (for output in fd like dprintf()), y (for output in buffer like snprintf());

  • output buffer

  • ft_qsort

ft_sort.h ft_sort.c

My own implementation of quicksort (aka qsort() from libc).

  • ft_print_memory

ft_print_memory.c

Function for print memory (like xxd cmd in unix).

  • Example
#include <libft.h>

typedef struct	s_test
{
	float	f;
	int		d;
	char	c1;
	char	c2;
	char	str[16];
}		t_test;

void	test()
{
	t_test	mem;

	mem.f = -1.25;
	mem.d = 123456789;
	mem.c1 = 'Q';
	mem.c2 = '@';
	ft_memcpy(&mem.str, "qwerty9417zhLF[", 16);
	ft_print_memory(&mem, sizeof(t_test));
}

int	main(void)
{
	ft_memman_init();
	test();
	ft_force_buff();
	ft_memman_clean();
	return (0);
}
  • Output
>./test/test
0000 a0bf 15cd 5b07 5140 7177 6572 7479 ......[.Q@qwerty
3934 3137 7a68 4c46 5b00 9d58           9417zhLF[..X

GO TO NEXT PAGE