-
Notifications
You must be signed in to change notification settings - Fork 0
/
man_3_printf
60 lines (56 loc) · 2.11 KB
/
man_3_printf
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.TH man 3 "17 October 2022" "GNU" "_printf man page"
.SH NAME
.B _printf
- Formatted output conversion
.SH SYNOPSIS
.B #include "holberton.h"
.B int _printf(const char *
.I format
.B , ...)
.SH DESCRIPTION
.B _printf()
Prints to standard output under the control of a
.I format
string that specifies how subsequent arguments are converted for output.
.SH Return value
Upon successful return, this function return the number of characters printed (excluding the null byte used to end output to strings).
If an output error is encountered, a negative value is returned.
.SH Format of the format string
The format string is composed of zero o more directives: ordinary character (not %), which ares copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments.By default, the arguments are used in the order given.
.SH The conversion specifier
A character that specifies the type of conversion to be applied. Te conversion specifiers are:
.TP
.B d, i
The int argument is converted to signed decimal notation.
.TP
.B c
The int argument is converted to an unsigned char, and the resulting character is written.
.TP
.B s
The const char * argument is expected to be a pointer to an array of character type (pointer to a string). Characters from the array are written up (but not including) a terminating null byte ('\0').
.TP
.B x, X
The unsigned int argument in converted to unsigned lowercase hexadecimal notation(x), or unsigned uppercase hexadecimal notation(X).
.TP
.B u
The unsigned int argument is converted to unsigned decimal notation.
.TP
.B o, b
The unsigned int argument is converted to unsigned octal notation(o) or binary notation(b).
.TP
.B r
Prints a string in reverse
.TP
.B R
Prints a string converted to rot13
.TP
.B %
A '%' is written but no argument is converted. The complete version specification is '%%'
.SH EXAMPLE
To print the day of the year, where weekday and month are pointers to strings and day and year are integers:
#include "holberton.h"
_printf("%s, %s %d, %d\\n", weekday, month, day, year);
.SH SEE ALSO
.I printf(3)
.SH AUTHOR
Isaac Abah, Sly Musa