MentOS  0.8.0
The Mentoring Operating System
Functions
stdio.c File Reference

Standard I/0 functions. More...

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 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 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...
 
void perror (const char *s)
 Prints a system error message. More...
 

Detailed Description

Standard I/0 functions.

Function Documentation

◆ atoi()

int atoi ( const char *  str)

Convert the given string to an integer.

Parameters
strThe string to convert.
Returns
The integer contained inside the string.

◆ fgetc()

int fgetc ( int  fd)

Same as getchar but reads from the given file descriptor.

Parameters
fdThe file descriptor from which it reads.
Returns
The read character.

◆ fgets()

char* fgets ( char *  buf,
int  n,
int  fd 
)

Same as gets but reads from the given file descriptor.

Parameters
bufThe buffer where the string should be placed.
nThe amount of characters to read.
fdThe file descriptor from which it reads.
Returns
The read string.

◆ getchar()

int getchar ( void  )

Returns the next character from the standard input (stdin).

Returns
The character received from stdin.

◆ gets()

char* gets ( char *  str)

Reads characters from the standard input (stdin).

Parameters
strWhere the characters are stored.
Returns
The string received from standard input.

◆ perror()

void perror ( const char *  s)

Prints a system error message.

Parameters
sthe message we prepend to the actual error message.

◆ putchar()

void putchar ( int  character)

Writes the given character to the standard output (stdout).

Parameters
characterThe character to send to stdout.

◆ puts()

void puts ( const char *  str)

Writes the string pointed by str to the standard output (stdout) and appends a newline character.

Parameters
strThe string to send to stdout.

◆ strtol()

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.

Parameters
strThis is the string containing the integral number.
endptrSet to the character after the numerical value.
baseThe base must be between 2 and 36 inclusive, or special 0.
Returns
Integral number as a long int value, else zero value is returned.