tgrekov-ft_printf
HIVE printf Feb 2024
Loading...
Searching...
No Matches
char.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* char.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/11/01 00:22:38 by tgrekov #+# #+# */
9/* Updated: 2024/02/13 07:56:59 by tgrekov ### ########.fr */
10/* */
11/* ************************************************************************** */
12
20#include <stdarg.h>
21#include <unistd.h>
22#include "../sequence.h"
23#include "../../utils/internal_types.h"
24
33int process_char(t_sequence seq, int *fd, int total)
34{
35 (void) total;
36 return (write(*fd, (char *) &seq.data, 1));
37}
38
47void pre_char(va_list args, t_sequence *seq)
48{
49 seq->data = (t_ubiggest) va_arg(args, int);
50 seq->total_len = 1;
51 seq->process = process_char;
52}
void pre_char(va_list args, t_sequence *seq)
Preprocess the character specifier by retrieving the character, setting s_sequence::total_len to 1 an...
Definition char.c:47
int process_char(t_sequence seq, int *fd, int total)
Processes the character specifier by writing a character. (Wow)
Definition char.c:33
unsigned long long t_ubiggest
Convenience typedef for largest unsigned type I need to handle.
Holds information regarding the current format specifier sequence.
Definition sequence.h:49
int(* process)(struct s_sequence, int *, int)
Function to use for processing this sequence's value.
Definition sequence.h:56
t_ubiggest data
Retrieved variable argument.
Definition sequence.h:53
int total_len
Total number of characters after padding.
Definition sequence.h:54