-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathman_3_printf
More file actions
78 lines (71 loc) · 2.05 KB
/
man_3_printf
File metadata and controls
78 lines (71 loc) · 2.05 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
.\" Man Page for _printf().
.TH man 3 "26 June 2023" "1.0" "_printf man page"
.SH NAME
.B _printf()
- Formatted output conversion.
.SH SYNOPSIS
.B #include "main.h"
.B int _printf(const char *
.I format
.B , ...)
.SH DESCRIPTION
.B _printf()
Produces output according to
.I format
(writes output to stdout, the standard output stream)
.SH RETURN VALUE
The number of characters printed (excluding the null byte used to end output to strings).
Else (-1) if an error is encountered.
.SH Format of the format string
The format string is a character string. The format string is composed of zero
or more directives: ordinary characters (not %), which are copied unchanged to
the output stream; and 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.
.SH Conversion Specifiers
A character that specifies the type of conversion to be applied.
The conversion specifiers and their meanings are:
.TP
.B c
the int argument is converted to an unsigned char, and the resulting character
is written.
.TP
.B 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').
.TP
.B d, i
The int argument is converted to signed decimal notation.
.TP
.B b
The int argument is converted to binary.
.TP
.B r
The string argument is reversed.
.TP
.B R
The string argument is encryted using ROT13.
.TP
.B %
A '%' is written. No argument is converted. The complete conversion
specification is '%%'.
.SH EXAMPLE
To print a character, string, and integers:
#include "main.h"
int main(void)
{
int len;
len = _printf("Let's try to printf a simple sentence.\n");
_printf("Character:[%c]\n", 'H');
_printf("String:[%s]\n", "I am a string !");
_printf("Length:[%d, %i]\n", len, len);
_printf("Negative:[%d]\n", -762534);
return (0);
}
.SH SEE ALSO
.I printf(3)
.SH BUGS
No known bugs
.SH AUTHOR
Samir Idris, Adebayo Abubakar