-
Notifications
You must be signed in to change notification settings - Fork 1
/
man_3_printf
executable file
·73 lines (70 loc) · 1.91 KB
/
man_3_printf
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
.TH Ourprintf "March 15 2021" "0.1" "_printf Manual Page"
.SH NAME
_printf - prints data output.
.SH SYNOPSIS
_printf FORMAT [Argument]...
.SH DESCRIPTION
_printf is an emulation of the original printf.
.sp
It produces an output of ARGUMENT(s) according to a FORMAT.
.SH RETURN VALUE
.sp
In a successful return, these functions will return the number of characters printed (excluding the null byte used to end output to strings). Return -1 if fail.
.sp
There are different type of flags that are used when you want to print with printf which we also emulated in _printf, we will see them below:
.sp
%d, %i - Print a number "%d" refering to a decimal number or "%i" to an integer (both are integer type).
.sp
%X, %x - Prints hexadecimal. The letters abcdef are used for x conversions and the letters ABCDEF are used for X conversions.
.sp
%c - The int argument is converted to an char, and prints the resulting characters.
.sp
% - A '%' is written. no argument is converted.
.sp
%s - Prints a string.
.sp
%u - Prints an unsigned int.
.sp
%r - prints a reversed string.
.sp
%R - Prints the rot13'ed string.
.sp
%o - Prints octal numbers.
.sp
%b - Prints binary numbers.
.SH FORMAT
The format string is the character % which will indicate the location and method to translate a piece of data.
.SH EXAMPLES
.sp
_printf("char: %c\n", 'H');
.sp
Output: char: H
.sp
_printf("string: %s\n", "Hello world !");
.sp
Output: string: Hello world !
.sp
_printf("integer: %i\n", 23);
Output: integer: 23
.sp
_printf("decimal: %d\n", 10000);
.sp
Output: decimal: 10000
.sp
_printf("float: %f\n", 1.23);
.sp
Output: float: 1.23
.sp
_printf("octal %o\n", 92);
Output: octal 134
.sp
_printf "percent: [%%]\n";
.sp
Output: percent: [%]
.SH BUGS
For any encounter of errors please report to the mails:
.SH AUTHORS
Written by Alfredo Delgado and Daniel Ortega
.sp
2624@holbertonschool.com or 2917@holbertonschool.com
2624@holbertonschool.com or 2917@holbertonschool.com