-
Notifications
You must be signed in to change notification settings - Fork 0
/
_printf
50 lines (45 loc) · 1.95 KB
/
_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
.TH _printf 1 "07/05/2022" "Version 0.9.9"
.TH man 3 "5 July 2022" "0.9.9" "_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()
Prints to standard output under the control of a
.I format
string that specifies how subsequent arguments are converted for output.
.SH Return value
On successful return, these functions return the number of characters printed, excluding the null byte used to end output to strings.
Will return a negative number on failure or error.
.SH Format of the format string
The format string is composed of 0 or more directives (normal characters that arent %), which are copied to the output. The format string is also made up of conversion modifiers that are then used to pull the proper function to print the specific data type that corresponds to the argument the modifier is referencing.
.SH The conversion specifier
A character that specifies the type of conversion to be applied. The conversion specifiers:
.TP
.BR c
The int argument is converted to an unsigned char, then 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 a terminating null byte, but do ot include the terminating null byte.
.TP
.B d, i
The int argument is converted to signed decimal notation in base 10.
.TP
.B %
A '%' is written but no argument is converted. The complete version specification is '%%'
.SH EXAMPLE
To print the day of the year, where weekday and month are pointers to strings and day and year are integers:
#include "main.h"
_printf("Bobby yelled about %s %d times!", thing, number);
.SH SEE ALSO
.I printf(3)
.SH BUGS
Bug where if an invalid number of args is provided, the program will compile despote the standard versoin
of printf throwing a compiler error.
.SH AUTHOR
Douglas Davison, Brayden Vernon