-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathman_3_printf
More file actions
executable file
·87 lines (67 loc) · 2.87 KB
/
man_3_printf
File metadata and controls
executable file
·87 lines (67 loc) · 2.87 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
.TH _printf 1 "March 20" "version 1.0" "_printf man page"
.SH NAME
_printf - format and print data
.SH SYNOPSIS
#include <unistd.h> <stdarg.h> <stdlib.h> "holberton.h"
int printf(const char *format, ...);
.SH DESCRIPTION
function that produces output according to a format. Writes 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. Execute according to option:
.I
.SS CONVERSION SPECIFIERS:
.RS
A character that specifies the type of conversion to be applied. The conversion specifiers and their meanings are:
.IP d,i
Decimal signed integer. The int argument is converted to signed decimal notation.
.IP c
Character. The int argument is converted to an unsigned char, and the resulting character is written.
.IP s
The const char * 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').
.IP o,u,x,X
The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal (x and X) notation. The letters abcdef are used for x conversions; the letters ABCDEF are used for X conversions.
.IP p
The void * pointer argument is printed in hexadecimal (as if by %#x or %#lx).
.I
.SS CUSTOM CONVERSION SPECIFIERS
.RS
.IP b
Decimal signed integer. The int argument is converted to binary notation.
.IP r
The const char * 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 n\ot including) a terminating null byte ('\0') in reverse order.
.IP R
The const char * 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 n\
\ot including) a terminating null byte ('\0') in ROT13 format.
.SH RETURN VALUE
.RS
Upon successful return, these functions return the number of characters printed (excluding the null byte used to end output to strings).
If an output error is encountered, a negative value (-1) is returned.
.SH EXAMPLES:
.RS
.SS --------------
.I
.SS Character[%c]:
.RS
.SS --------------
.SS Input _printf("This is a char: [%c]", 'C');
.SS Output This is a char: [C]
.SS --------------
.I
.SS Literal String:
.RS
.SS --------------
.SS Input _printf("Let's try to printf a simple sentence");
.SS Output Let's try to printf a simple sentence
.SS --------------
.I
.SS Integers[%i]:
.RS
.SS --------------
.SS Input _printf("This is a number: [%i]", 20);
.SS Output This is a number: [20]
.SS --------------
.RE
.SH SEE ALSO
.I printf(3)
.SH BUGS
Report _printf bugs to Andrés Bayona (andres.bayona@holbertonschool.com) or Tatiana Orejuela (tatiana.orejuela@holbertonschool.com)
.SH AUTHORS
Andrés Bayona, Tatiana Orejuela.