MentOS  0.8.0
The Mentoring Operating System
stdio.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "stdarg.h"
9 #include "stddef.h"
10 
12 #define MAX_DIGITS_IN_INTEGER 11
14 #define GETS_BUFFERSIZE 255
15 
16 #ifndef EOF
18 #define EOF (-1)
19 #endif
20 
21 #define SEEK_SET 0
22 #define SEEK_CUR 1
23 #define SEEK_END 2
24 
25 #ifndef __KERNEL__
28 void putchar(int character);
29 
33 void puts(const char *str);
34 
37 int getchar(void);
38 
42 char *gets(char *str);
43 
47 int fgetc(int fd);
48 
54 char *fgets(char *buf, int n, int fd);
55 #endif
56 
60 int atoi(const char *str);
61 
68 long strtol(const char *str, char **endptr, int base);
69 
75 int printf(const char *fmt, ...);
76 
83 int sprintf(char *str, const char *fmt, ...);
84 
85 #ifndef __KERNEL__
92 int fprintf(int fd, const char *fmt, ...);
93 
100 int vfprintf(int fd, const char *fmt, va_list args);
101 #endif
102 
109 int vsprintf(char *str, const char *fmt, va_list args);
110 
111 #ifndef __KERNEL__
117 int scanf(const char *fmt, ...);
118 
125 int sscanf(const char *str, const char *fmt, ...);
126 
133 int fscanf(int fd, const char *fmt, ...);
134 #endif
135 
138 void perror(const char *s);
Contains the macros required to manage variable number of arguments.
char * va_list
The va_list type is an array containing a single element of one structure containing the necessary in...
Definition: stdarg.h:11
Define basic data types.
int vfprintf(int fd, const char *fmt, va_list args)
Write formatted data from variable argument list to a file.
Definition: vsprintf.c:892
void putchar(int character)
Writes the given character to the standard output (stdout).
Definition: stdio.c:14
int scanf(const char *fmt,...)
Read formatted input from stdin.
Definition: vscanf.c:130
int getchar(void)
Returns the next character from the standard input (stdin).
Definition: stdio.c:24
int fprintf(int fd, const char *fmt,...)
Write formatted output to a file.
Definition: vsprintf.c:906
int printf(const char *fmt,...)
Write formatted output to stdout.
Definition: vsprintf.c:698
int sscanf(const char *str, const char *fmt,...)
Read formatted data from string.
Definition: vscanf.c:119
int vsprintf(char *str, const char *fmt, va_list args)
Write formatted data from variable argument list to string.
Definition: vsprintf.c:488
int sprintf(char *str, const char *fmt,...)
Write formatted output to str.
Definition: vsprintf.c:711
int fscanf(int fd, const char *fmt,...)
The same as sscanf but the source is a file.
Definition: vscanf.c:141
char * fgets(char *buf, int n, int fd)
Same as gets but reads from the given file descriptor.
Definition: stdio.c:209
void perror(const char *s)
Prints a system error message.
Definition: stdio.c:244
void puts(const char *str)
Writes the string pointed by str to the standard output (stdout) and appends a newline character.
Definition: stdio.c:19
char * gets(char *str)
Reads characters from the standard input (stdin).
Definition: stdio.c:33
int fgetc(int fd)
Same as getchar but reads from the given file descriptor.
Definition: stdio.c:189
long strtol(const char *str, char **endptr, int base)
Converts the initial part of str to a long int value according to the given base, which.
Definition: stdio.c:29
int atoi(const char *str)
Convert the given string to an integer.
Definition: stdio.c:14