tgrekov-ft_printf
HIVE printf Feb 2024
Loading...
Searching...
No Matches
utils.h File Reference

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/16 17:32:00 by tgrekov #+# #+# */
/* Updated: 2024/02/13 06:29:06 by tgrekov ### ########.fr */
/* */
/* ************************************************************************** */

Definition in file utils.h.

#include "internal_types.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int u_len_base (t_ubiggest n, int base)
 Determine the length of unsigned number n in base base.
 
int u_put_base (t_ubiggest n, char *base, int fd)
 Write unsigned number n on descriptor fd in base base.
 
int repeat_str_n (const char *str, int n, int fd)
 Write exactly n characters from str on descriptor fd. Repeats string if ft_strlen(str) is greater than n.
 
int wrap_err (int n, int *total)
 Wrapper for handling functions that return a positive integer on success and -1 on failure. Either adds positive integer n to the value at total, or sets it to -1.
 

Function Documentation

◆ repeat_str_n()

int repeat_str_n ( const char *  str,
int  n,
int  fd 
)

Write exactly n characters from str on descriptor fd. Repeats string if ft_strlen(str) is greater than n.

Parameters
[in]str
[in]n
[in]fd
Return values
intNumber of characters written, or -1 on error.

Definition at line 50 of file repeat_str_n.c.

References ft_strlen().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ u_len_base()

int u_len_base ( t_ubiggest  n,
int  base 
)

Determine the length of unsigned number n in base base.

Parameters
[in]n
[in]base
Return values
intLength of n.

Definition at line 29 of file u_len_base.c.

◆ u_put_base()

int u_put_base ( t_ubiggest  n,
char *  base,
int  fd 
)

Write unsigned number n on descriptor fd in base base.

Parameters
[in]n
[in]base
[in]fd
Return values
intNumber of characters written, or -1 on error.

Definition at line 49 of file u_put_base.c.

◆ wrap_err()

int wrap_err ( int  n,
int *  total 
)

Wrapper for handling functions that return a positive integer on success and -1 on failure. Either adds positive integer n to the value at total, or sets it to -1.

Parameters
[in]n
[in,out]total
Return values
intIf n is positive, returns 1. Return 0 if it is -1.

Definition at line 29 of file wrap_err.c.

References wrap_err().

Here is the call graph for this function:
Here is the caller graph for this function: