-
Notifications
You must be signed in to change notification settings - Fork 0
/
man_3_printf
126 lines (117 loc) · 6.14 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
.\" Manpage for _printf.
.TH _printf 3 "17 May 2022" "1.0" "Program Manual for _printf"
.SH NAME
_printf - formatted output conversion and print data.
.SH SYNOPSIS
.nf
.BI printf (FORMAT, ARGUMENT)...
.PP
.BI "#include 'main.h'"
.BI "#include <stdarg.h>"
.BI "#include <unistd.h>"
.PP
.BI "int _printf(const char *format, ...);"
.BI "int print_c_stdout(va_list __attribute__((unused)), char *, unsigned int);"
.BI "int print_char(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_str(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_int(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_binary(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_usi(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_oct(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_decihexa(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_deci_hexadeci(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_svc(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_add(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_reverse(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_rot(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int printl_int(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_long_usi(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_long_oct(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int printlong_decihex(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_long_decihex(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_si(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_susi(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_long_doct(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int printshort_hex(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int printshort_decihex(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_plus_int(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_num_oct(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_hex_zero(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_num_up(va_list arguments, char *buffer, unsigned int index_buffer);"
.BI "int print_space_int(va_list arguments, char *buffer, unsigned int index_buffer);"
.PP
.BI "int (*get_print_func(const char *s, int index))(va_list, char *, unsigned int);"
.BI "int ret_print_func(const char *s, int index);"
.PP
.BI "unsigned int handle_buffer(char *buffer, char c, unsigned int index_buffer);"
.BI "int print_buffer(char *buffer, unsigned int num_buffer);"
.PP
.BI "char *build_binary_array(char *binary, long int int_in, int isneg, int limit);"
.BI "char *build_oct_array(char *bnr, char *oct);"
.BI "char *build_long_oct_array(char *bnr, char *oct);"
.BI "char *build_short_oct_array(char *bnr, char *oct);"
.BI "char *build_hex_array(char *bnr, char *hex, int isupp, int limit);"
.PP
.SH DESCRIPTION
The output function _printf() produce output according to a format. the function _printf converts the character strings that receives as argument and prints it on the standard output.
.SH RETURN VALUE
Returns the number of all the characters printed, excluding the NULL byte used to end output to strings.
.SH Format String Format
The format string is a character string, which contains two types of directives: ordinary characters which are coppied to the output stream; and conversion specifiers. Each conversion specification is introduced by the character %, and ends with a conversion specifier.
.SH Conversion Specifiers
This are the characters that specifies the type of conversion to be applied. The conversion specifiers and their meanings are:
.TP
.B c
.R The \fIint\fR argument is converted to an \fIunsigned char\fR, and the resulting character is written.
.TP
.B s
.R The \fIconst char *\fR argument is a pointer to an array of characters, that converts the corresponding argument to a character string.
.TP
.B d, i
.R The \fIint\fR argument is converted to signed decimal notation.
.TP
.B o, u, x, X
.R The \fIunsigned int\fR argument is converted to unsigned octal \fIo\fR (base 8 number), unsigned decimal \fIu\fR (base 10 number), unsigned hexadecimal \fIx\fR (base 16 number with lowercase letters) and unsigned hexadecimal \fIX\fR (base 16 number with uppercase letters).
.TP
.B %, %%
.R If only the \fI%\fR character is written no argument is converted. The complete conversion specification is \fI%%\fR, that returns the actual sign if there in front.
.TP
.B S
.R The \fIconst char\fR argument is a pointer to an array of characters, that converts the corresponding argument to a character st\
ring, with non-printable characters (0 < ASCII value < 32 or >= 127).
.TP
.B p
.R The \fIvoid * pointer\fR argument is printed in hexadecimal.
.TP
.B S
.R The \fIconst char\fR argument is a pointer to an array
.SH The flag characters
The character \fI%\fR is followed by zero the following flags:
.TP
.B +
.R A sign \fI+\fR or \fI-\fR will be placed before a number followed by a signed conversion.
.TP
.B #
.R Print number in hexadecimal, upeercase hexadecimal and octal where the first character of the output string is made zero.
.TP
.B ' '
.R A space in blank should be left before a positive number followed by a signed conversion.
.SH NOTES
.R The \fB_printf()\fR is a project collaboration between \fBPrideland Okoi\fR and \fBNnenna Alie\fR, actual students of Software Engineering at \fBHolberton School\fR.
.SH BUGS
.R In process
.SH EXAMPLE
.R To print the the string \fBHello Holberton!\fR and its length in decimal.
#include ''main.h''
int main(void)
{
int length;
_printf(''%s'', ''Hello, Holberton!'')
_printf(''Hello Holberton! contains %d characters'', length);
length = _printf(''Hello Holberton!'');
return (0);
}
.SH SEE ALSO
.R printf(3)
.SH AUTHORS
Written by \fBPrideland Okoi\fR and \\fBNenna AliefR.