-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert_n.c
37 lines (33 loc) · 1.33 KB
/
convert_n.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
25
26
27
28
29
30
31
32
33
34
35
36
37
/* ************************************************************************** */
/* */
/* :::::::: */
/* convert_n.c :+: :+: */
/* +:+ */
/* By: mraasvel <[email protected]> +#+ */
/* +#+ */
/* Created: 2020/11/13 16:17:34 by mraasvel #+# #+# */
/* Updated: 2020/11/22 17:36:29 by mraasvel ######## odam.nl */
/* */
/* ************************************************************************** */
#include "ft_conversion.h"
/*
** FLAGS:
** 'l' = long* 'll' = long long*
** 'h' = short* 'hh' = signed char*
*/
int convert_n(va_list start, t_flags flags, int n)
{
void *ptr;
if (flags.l == 1)
ptr = va_arg(start, long*);
else if (flags.ll == 1)
ptr = va_arg(start, long long*);
else if (flags.h == 1)
ptr = va_arg(start, short*);
else if (flags.hh == 1)
ptr = va_arg(start, signed char*);
else
ptr = va_arg(start, int*);
*(int*)ptr = n;
return (0);
}