-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathman_3_printf
81 lines (66 loc) · 1.84 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
.TH _PRINTF 3
.SH NAME
_printf - _printf is a recreation of the printf function.
.SH SYNOPSIS
\fB#include "holberton.h"\fR
\fBint _printf(const char *\fR\fIformat\fR\fB, ...);\fR
.SH DESCRIPTION
\fB_printf()\fR writes to the standard output according to a format specifier. The specifiers are listed below.
.B Return Value
.RS 3
The return value of a successful call to _printf is the number of characters printed, excluding the terminating NULL byte.
On failure, a -1 is returned.
.RE
.B The Conversion Specifier
.RS 3
The following characters are what \fB_printf()\fR is able to convert, along with their matching descriptions.
.B i, d
.RS 6
The \fIint\fR argument is converted to signed decimal notation.
.RE
.B c
.RS 6
The \fIint\fR argument is converted to an unsigned char, and the resulting character is written.
.RE
.B s
.RS 6
The \fIconst char *\fR 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 (but not including) a terminating null byte ('\\0').
.RE
.B r
.RS 6
The \fIconst char *\fR argument is expected to be a pointer to an array of character type (pointer to a string). Characters from the array are written in reverse from the end of the string (excluding the terminating null byte) to the beginning.
.RE
.B %
.RS 6
A '%' is written. No argument is converted. The complete conversion specifications i '%%'.
.RE
.SH NOTES
This program does not account for flag characters, field width, precision, or length modifiers.
.SH EXAMPLE
.RS 3
Print a sentence using conversion specifiers:
.RE
.RS 8
#include "holberton.h"
.br
int main (void)
.br
{
.br
.RS 8
_printf("Pr%dgram%cing is %s!\\n", 0, 'm', "fun");
.br
return (0);
.RE
.br
}
.RE
.RS 3
Output : "Pr0gramming is fun!"
.RE
.SH SEE ALSO
.B printf(3)
.SH BUGS
No known bugs.
.SH AUTHOR
Jinji Zhang, Robert Glatzel