-
Notifications
You must be signed in to change notification settings - Fork 8
/
man_3_printf
127 lines (91 loc) · 2.32 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
.\" _printf man page
.\"
.\"
.\"
.\"
.\"
.TH _PRINTF "May 20 2022" "0.1" "Library functions manual"
.SH NAME
.SH ""
.B _printf
- custom version for printf function.
.SH SYNOPSIS
.SH ""
#include "mainn.h"
int _printf(const char *[FORMAT], ...);
.SH DESCRIPTION
.SH ""
The printf function sends formatted output to stdout.
A custom _printf() for learning purposes was developed by cohort #6 students Udoka Christopher and Hope Akpabio as a project in ALX.
_printf() function format string is a character string, beginning and ending in its initial shift state, if any.
These arguments are placed using the percentage '%' operator
.SS Compilation
.P
.RS
#include "main.h"
$ gcc -Wall -Werror -Wextra -pedantic -Wno-format *.c
$ gcc -Wall -Werror -Wextra -pedantic -g -Wno-format *.c (for gdb debbuging)
.RE
.SS Printing
.RS
int _printf(const char *[FORMAT], ...);
FORMAT is the string that takes n specifier followed by a '%'
symbol. i.e. "Hello this is %s from %d cohort". '...' is the variadic \
(any type of variable).
.SS Example
.RS
.B Input
.PP
_printf("Hello this is %s from %d cohort\\n\\", 33);
.PP
.B Output
.PP
Hello this is %s from %d cohort
.RE
.SS Return Value
Return value is a n number of characters except NULL
.SH FLAG SPECIFIERS
.SH ""
custom and non-custom specifier modifiers
.SH THE LENGTH MODIFIERS
.SH ""
Length modifiers.
.SH THE CONVERSION SPECIFIERS
.SH ""
.RS
Current arguments handled by conversion specifiers:
.IT
.B %
- % symbol is set without argument and conversion specification has to be'%%'.
.IT
.B c
- integer or char argument converted to unsigned char.
.IT
.B d, i
- int argument is converted to signed decimal integer.
.IT
.B s
- string argument. _printf handles s conversion specifier if the argument value
is not a pointer to a literal string. \
.IT
.B o, u, x, X
- unsigned int argument converted to unsigned octal (o), unsigned decimal (u),
unsigned hexidecimal notation (x) for lower case and (X) for upper case
.IT
.B b
- The unsigned int argument is converted to binary.
.IT
.B p
- The pointer is printed in hexidecimal format preceded by '0x'.
.IT
.B r, R
- 'r' prints string in reverse. 'R' prints encrypted rot13.
.IT
.B S
- ascii <32 & >127 has to appear in the argument string. converted to
hexadecimal preceded by \x
.RE
.P
.SH "AUTHORS"
.SH ""
Nwabueze Franklin and Ifeoluwa Atansieye