forked from Gotmished/holbertonschool-printf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathman_3_printf
More file actions
69 lines (57 loc) · 1.94 KB
/
man_3_printf
File metadata and controls
69 lines (57 loc) · 1.94 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
.\" Manpage for _printf
.TH man 3 "10 July 2022" "1.0.0" "_printf man page"
.SH NAME
.B _printf
- formatted output conversion
.SH SYNOPSIS
#include "main.h"
.B int _printf(const char *
.I format
.B , ...);
.SH DESCRIPTION
.B _printf()
Prints arguments to standard output according to a
.I format
string specifying how the arguments are converted.
.SS Format of the format string
A string of characters. Each conversion specification is introduced by the
.B %
character, followed by a single-character
.I conversion specifier.
Arguments must correspond to the conversion specifier supplied, and if more than one argument is given, each is used in the order listed by default.
An example of the command including single argument for a character is as follows:
.IP
_printf("This is the %ctring to print\\n", 's')
.SS Conversion specifiers
The conversion to be applied to an argument is specified by the following characters:
.TP
.BR c
The int argument is converted to an unsigned char, and the resulting character is written.
.TP
.BR 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
.BR %
A '%' character is written, and no argument is converted. The complete conversion specification is '%%'
.SH RETURN VALUE
Upon successful return, this function returns the number of characters printed (excluding the null byte used to end output strings). If an output error is encountered, a negative value is returned.
.SH KNOWN BUGS
None
.SH EXAMPLES
.SS To print two strings:
.IP
#include "main.h"
.IP
_printf("String one: %s & String two: %s\\n", "Hello", "World");
.SS To print a character and a decimal number:
.IP
#include "main.h"
.IP
_printf("Character: %c & Number: %d\\n", 'H', 78001);
.SH SEE ALSO
.I printf(3)
.SH AUTHORS
Luke Hackett & Hamish Ross