-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathman_3_printf
More file actions
executable file
·92 lines (78 loc) · 2.59 KB
/
man_3_printf
File metadata and controls
executable file
·92 lines (78 loc) · 2.59 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
.TH man 3_PRINTF "21 JULY 2020" "Holberton School Colombia"
.SH NAME
.B _Printf
- _Printf The functions in the _printf family produce output according to a format as described below.
.SH SYNOPSIS
#include "holberton.h"
.NM _printf Function with one mandatory argument FORMAT.
int _printf(const char *format, ...);
.SH DESCRIPTION
The functions in the _printf family produce output according to a format as described below. The functions and write output to stdout; write output to the given output stream; and write to the character string.
.SH Return Value
Upon successful return, these functions return the number of characters printe(excluding the null byte used to end output to strings).
.SH 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; an 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. In between there may be (in this order zero or more flags, an optional minimum field width, an optional precision an an optional length modifier.
.SH Conversion specifiers.
The format string is a character string, beginning and ending in its initial shift state, if any.
.SH %
The character % is followed by zero or more of the following flags:
.SH c
Print a character.
.SH i
Print a single integer.
.SH d
Print a decimal number.
.SH s
Print a string.
.SH b
Print a binary.
.SH r
Print reverse.
.SH R
Print ROT13
.SH U
Print an unsigned number
.SH o
Print Octal
.SH x X
Print hexadecimal
.SH P
Print address of a pinter
.SH EXAMPLES
Some examples of _printf
_printf("String:[%s]\n", "I am a string !");
.PP
String:[I am a string !]
len = _printf("Let's try to printf a simple sentence.\n");
.PP
Length:[39, 39]
_printf("Negative:[%d]\n", -762534);
.PP
Negative:[-762534]
_printf("Unsigned:[%u]\n", ui);
.PP
Unsigned:[2147484671]
_printf("Unsigned octal:[%o]\n", ui);
.PP
Unsigned octal:[20000001777]
_printf("Unsigned hexadecimal:[%x, %X]\n", ui, ui);
.PP
Unsigned hexadecimal:[800003ff, 800003FF]
_printf("Character:[%c]\n", 'H');
.PP
Character:[H]
_printf("Address:[%p]\n", addr);
.PP
Address:[0x7ffe637541f0]
len = _printf("Percent:[%%]\n");
.PP
Percent:[%]
_printf("Unknown:[%r]\n");
.PP
Len:[12]
.SH SEE ALSO
printf(), scanf(), fprintf(), vfprintf()
.SH AUTHORS
.NM
Oscar de Leon Giraldo - https://github.com/serosc95
Andres felipe Barrera - https://github.com/Andres802