MentOS
0.8.0
The Mentoring Operating System
|
Standard I/0 functions. More...
Go to the source code of this file.
Macros | |
#define | MAX_DIGITS_IN_INTEGER 11 |
The maximum number of digits of an integer. | |
#define | GETS_BUFFERSIZE 255 |
The size of 'gets' buffer. | |
#define | SEEK_SET 0 |
The file offset is set to offset bytes. | |
#define | SEEK_CUR 1 |
The file offset is set to its current location plus offset bytes. | |
#define | SEEK_END 2 |
The file offset is set to the size of the file plus offset bytes. | |
Functions | |
void | putchar (int character) |
Writes the given character to the standard output (stdout). More... | |
void | puts (const char *str) |
Writes the string pointed by str to the standard output (stdout) and appends a newline character. More... | |
int | getchar (void) |
Returns the next character from the standard input (stdin). More... | |
char * | gets (char *str) |
Reads characters from the standard input (stdin). More... | |
int | fgetc (int fd) |
Same as getchar but reads from the given file descriptor. More... | |
char * | fgets (char *buf, int n, int fd) |
Same as gets but reads from the given file descriptor. More... | |
int | atoi (const char *str) |
Convert the given string to an integer. More... | |
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. More... | |
int | printf (const char *fmt,...) |
Write formatted output to stdout. More... | |
int | sprintf (char *str, const char *fmt,...) |
Write formatted output to str . More... | |
int | fprintf (int fd, const char *fmt,...) |
Write formatted output to a file. More... | |
int | vfprintf (int fd, const char *fmt, va_list args) |
Write formatted data from variable argument list to a file. More... | |
int | vsprintf (char *str, const char *fmt, va_list args) |
Write formatted data from variable argument list to string. More... | |
int | scanf (const char *fmt,...) |
Read formatted input from stdin. More... | |
int | sscanf (const char *str, const char *fmt,...) |
Read formatted data from string. More... | |
int | fscanf (int fd, const char *fmt,...) |
The same as sscanf but the source is a file. More... | |
void | perror (const char *s) |
Prints a system error message. More... | |
Standard I/0 functions.
int atoi | ( | const char * | str | ) |
Convert the given string to an integer.
str | The string to convert. |
int fgetc | ( | int | fd | ) |
Same as getchar but reads from the given file descriptor.
fd | The file descriptor from which it reads. |
char* fgets | ( | char * | buf, |
int | n, | ||
int | fd | ||
) |
Same as gets but reads from the given file descriptor.
buf | The buffer where the string should be placed. |
n | The amount of characters to read. |
fd | The file descriptor from which it reads. |
int fprintf | ( | int | fd, |
const char * | fmt, | ||
... | |||
) |
Write formatted output to a file.
fd | The file descriptor associated with the file. |
fmt | Format string, following the same specifications as printf. |
... | The list of arguments. |
int fscanf | ( | int | fd, |
const char * | fmt, | ||
... | |||
) |
The same as sscanf but the source is a file.
fd | The file descriptor associated with the file. |
fmt | Format string, following the same specifications as printf. |
... | The list of arguments where the values are stored. |
int getchar | ( | void | ) |
Returns the next character from the standard input (stdin).
char* gets | ( | char * | str | ) |
Reads characters from the standard input (stdin).
str | Where the characters are stored. |
void perror | ( | const char * | s | ) |
Prints a system error message.
s | the message we prepend to the actual error message. |
int printf | ( | const char * | fmt, |
... | |||
) |
Write formatted output to stdout.
fmt | The format string. |
... | The list of arguments. |
void putchar | ( | int | character | ) |
Writes the given character to the standard output (stdout).
character | The character to send to stdout. |
void puts | ( | const char * | str | ) |
Writes the string pointed by str to the standard output (stdout) and appends a newline character.
str | The string to send to stdout. |
int scanf | ( | const char * | fmt, |
... | |||
) |
Read formatted input from stdin.
fmt | Format string, following the same specifications as printf. |
... | The list of arguments where the values are stored. |
int sprintf | ( | char * | str, |
const char * | fmt, | ||
... | |||
) |
Write formatted output to str
.
str | The buffer where the formatted string will be placed. |
fmt | Format string, following the same specifications as printf. |
... | The list of arguments. |
int sscanf | ( | const char * | str, |
const char * | fmt, | ||
... | |||
) |
Read formatted data from string.
str | String processed as source to retrieve the data. |
fmt | Format string, following the same specifications as printf. |
... | The list of arguments where the values are stored. |
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.
str | This is the string containing the integral number. |
endptr | Set to the character after the numerical value. |
base | The base must be between 2 and 36 inclusive, or special 0. |
int vfprintf | ( | int | fd, |
const char * | fmt, | ||
va_list | args | ||
) |
Write formatted data from variable argument list to a file.
fd | The file descriptor associated with the file. |
fmt | Format string, following the same specifications as printf. |
args | A variable arguments list. |
int vsprintf | ( | char * | str, |
const char * | fmt, | ||
va_list | args | ||
) |
Write formatted data from variable argument list to string.
str | Pointer to a buffer where the resulting C-string is stored. |
fmt | Format string, following the same specifications as printf. |
args | A variable arguments list. |