-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathman_3_printf
81 lines (74 loc) · 2.48 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 man 3 "11 July 2022" "0.01" "_printf man page"
.SH NAME
.B _printf
- A simple re-creation of the printf function
.SH SYNOPSIS
To use this function the #include "main.h" header is needed.
.SH DESCRIPTION
The _printf "() function produce output according to a" format " as described below. Also, write output to " stdout ", the standard output stream."
.LP
The _printf "() function write the output under the control of a format string that specifies how subsequent arguments (or arguments accessed via the variable-length argument facilities of " stdarg "(3) are converted for output."
.SS Format of the format string
The format string is a character string, beginning and ending in its initial shift state, if any. The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments. Each conversion specification is introduced by the character '%' and ends with a conversion specifier.
.SS Conversion specifiers
A character that specifies the type of conversion to be applied. The conversion specifiers and their meaning are:
.RS 3
%c: To be used to print characters
.RS 0
%s: To be used to print strings
.RS 0
%d: To print integers of max and min size of an int type
.RS 0
%i: To print integers of max and min size of an int type
.RS 0
%b: To print a number in binary form
.RS 0
%p: To print an adddress.
.RS 0
%r: To reverse a string
.RS 0
%x: To print in lower-case hexadecimal.
.RS 0
%X: To print in upper-case hexadecimal.
.RS 0
%o: To print in octal.
.RS 0
%u: To print unsigned integers.
.RS 0
%I: To print in rot13
.SH RETURN VALUES
The _printf() function returns an integer representing the number of symbols
printed not counting the null ('\0') for the string.
.SH SEE ALSO
.I printf(3)
.SH BUGS
No known bugs.
.SH EXAMPLES
To print:
.PP
.RS 3
.B #include "main.h"
.PP
_printf("Hello School");
.B // the output will be 'Hello School'
.PP
_printf("%c", 'H');
.B // the ouput will be 'H'
.PP
_printf("%s", "Hello School");
.B // the output will be 'Hello School'
.PP
_printf("%!\\n");
.B // the output will be '%!'
.PP
_printf("This %s amazing, isn't it!.\\n", "is");
.B // the output will be 'This is amazing, isn't it!.'
.PP
_printf("% s", "Hello");
.B // the output will be 'Hello'
.PP
_printf("% j");
.B // the output will be '% j'
.RE
.SH AUTHORS
[MissTipo](https://github.com/MissTipo) | [IsaacPhiri](https://github.com/IsaacPhiri)