-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathman_3_printf
149 lines (71 loc) · 2.8 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
.TH man 3 "15 October 2022" "0.1" "_printf man page"
.SH NAME
.B _printf
- Formatted output conversion.
.SH SYNOPSIS
.B #include "main.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
On successful return, these functions 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 0 or more directives (ordinary characters that are not %), which are copied to the output stream. The format string is also composed of conversion specifications, each of which result in fetching zero or more subsequent arguments. Each conversion specification is introduced by the character % and ends with the conversion specifier.
The argument must correspond properly with the conversion specifier. 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. The conversion specifiers and their meanings are:
.TP
.BR c
The int argument is converted to an unsigned char, then 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 to a terminating null byte, but do ot include the terminating null byte.
.TP
.B S
Prints a string. Non printable characters are printed as "\x" followed by their ASCII values in two digit hexadecimal
.TP
.B d, i
The int argument is converted to signed decimal notation.
.TP
.B u
The unsigned int argument is converted to unsigned decimal notation
.TP
.B o
The unsigned int argument is converted to unsigned octal notation.
.TP
.B x
The unsigned int argument is converted to unsigned lowercase hexadecimal notation.
.TP
.B X
The unsigned int argument is converted to unsigned uppercase hexadecimal notation.
.TP
.B b
The unsigned int argument is converted to unsigned binary notation.
.TP
.B p
Address is printed in hexadecimal.
.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 "main.h"
_printf("%s, %s %d, %d\\n", weekday, month, day, year);
.SH SEE ALSO
.I printf(3)
.SH BUGS
No known bugs, If one is found sent your report to https://github.com/Savissy and https://github.com/Starrgrace
.SH AUTHOR
Saviour Uzoukwu, Olasunkanmi Emmanuel