libft
Loading...
Searching...
No Matches
Functions
print_formatted_number.c File Reference

Handles formatting and output of integers in ft_printf. More...

#include "libft.h"
+ Include dependency graph for print_formatted_number.c:

Functions

static char * apply_plus_space_hash_flags (t_pf *pf, char *str, int *len)
 Applies +, space, and # flags to the formatted number.
 
static char * prepend_sign (char *str, char sign, t_pf *pf)
 Prepends a sign character (+ or space) to a number string.
 
void print_formatted_number (t_fmt *fmt, char *str, int len, t_pf *pf)
 Final formatter and dispatcher for integer output.
 
static void print_with_padding (t_pf *pf, char *str, int padding)
 Writes the number string with left/right padding.
 
static void print_zero_padding_int (int padding, char **str_ptr, t_pf *pf)
 Writes zero-padding and handles printing the sign first if needed.
 

Detailed Description

Handles formatting and output of integers in ft_printf.

This module formats and prints integer-based conversions (d, i, u, x, X) according to the format flags provided:

It builds a final formatted string with prefixes and signs, calculates padding, and outputs everything while tracking write or allocation failures.

Author
Toonsa
Date
2024/10/29