-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_ptr.c
executable file
·24 lines (22 loc) · 1.1 KB
/
ft_ptr.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ptr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ngouy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/01/16 13:01:51 by ngouy #+# #+# */
/* Updated: 2015/02/17 15:57:50 by ngouy ### ########.fr */
/* */
/* ************************************************************************** */
#include "header.h"
char *ft_ptr(long int ptr, t_opt *opt)
{
if (ptr == 0 && (opt->prec < 0 || opt->spec == 15))
{
return ("0x");
}
if (opt->prec > 0)
opt->prec += 2;
return (ft_strjoin("0x", long_int_to_smt(ptr, 'x')));
}