-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathman_3_printf
More file actions
114 lines (75 loc) · 2.15 KB
/
man_3_printf
File metadata and controls
114 lines (75 loc) · 2.15 KB
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
.TH man 3 "15 Mar 2022" "Holberton School Peru"
.Dt _printf 3
.SH NAME
_printf (): Formatted output convertion.
.SH SYNOPSIS
#include "main.h"
.SH SYNTAX
int _printf (const char *format, ...)
.SH DESCRIPTION
The _printf() function takes one argument: A string with / without specifiers to print and gives the output formatted.
The string is printed character by character and when founds a '%' with a letter calls one of that parameters and print them instead the specifiers.
The format specifiers are:
Format generators are a format with which we tell the function to take the arguments according to the indicated type.
.SH RETURN VALUE
The _printf() function returns the number of characters printed.
.SH SPECIFIERS
.B %c
Print a character passed as parameter.
.B %s
Prints a string.
.B %%
Print a percentage symbol.
.B %d
Prints a signed decimal number.
.B %i
Prints a signed number (int).
.B %b
Converts the unsigned integer to binary and prints it.
.B %r
Print the inverted string.
.B %R
Use ROT13 to converts the letters with the thirteenth letter forward of the alphabet.
.SH EXAMPLE
.nf
#include "main.h"
int main (void)
{
_printf ("I am a character %s", 'F');
_printf ("%s", "string");
_printf ("I am percentage %%");
_printf ("I am an integer %i", 10);
_printf ("I am a binary %b", 54);
return (0);
}
.ni
.SH FUTURE FEATURES
.B %S
Prints a string of characters and the number in hexadecimal of a special character that is written like this '\x' according to the ASCII table.
.B %u
Prints an unsigned decimal number.
.B %o
Prints the octal unsigned integer conversion.
.B %x
Unsigned hex conversion to lowercase.
.B %X
Unsigned hex conversion to uppercase.
.B %p
Print a memory address(pointer).
.SH FLAG CHAR (FUTURE FEATURES)
.B +
Print the '+' symbol in front of the positive number occupying one space wide.
.B Space
Invisible plus sign. A blank space is left before the number occupying a space in the width.
.B #
Prepend a print of a zero '0' over an octal number.
.B 0
Fill in zero to the left.
.B -
Justify left.
.SH BUGS
The specifier %b doesn't work all correctly
.SH SEE ALSO
printf (3)
.SH AUTHOR
Diego Linares and Luis Manrique