Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
Data Structures | Macros | Functions | Variables
stdio.h File Reference
#include <pthread.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/reent.h>
#include <sys/types.h>
Include dependency graph for stdio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  FILE
 

Macros

#define SEEK_SET   0
 
#define SEEK_CUR   1
 
#define SEEK_END   2
 
#define fopen   _fopen
 
#define fclose   _fclose
 
#define fread   _fread
 
#define fwrite   _fwrite
 
#define fseek   _fseek
 
#define fileno   _fileno
 
#define __SIZEOF_FILE   sizeof(__FILE)
 

Functions

FILEfopen (const char *pathname, const char *mode)
 Open the file whose name is the string pointed to by pathname and associate a stream with it. More...
 
int fclose (FILE *stream)
 Close the given file stream. More...
 
size_t fread (void *ptr, size_t size, size_t nmemb, FILE *stream)
 Read nmemb items of data, each size bytes long, from the stream pointed to by stream, storing them at the location given by ptr. More...
 
size_t fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream)
 Write nmemb items of data, each size bytes long, to the stream pointed to by stream, obtaining them from the location given by ptr. More...
 
int fseek (FILE *stream, long offset, int whence)
 Set the file position indicator for the stream pointed to by stream. More...
 
int fileno (FILE *stream)
 Examine the argument stream and returns the integer file descriptor used to implement this stream. More...
 
int printf (const char *format,...)
 Format and print data to the standard output. More...
 
int fprintf (FILE *stream, const char *format,...)
 Format and print data to a file. More...
 
int dprintf (int fd, const char *format,...)
 Format and print data to a file. More...
 
int sprintf (char *str, const char *format,...)
 Format and print data to a buffer. More...
 
int snprintf (char *str, size_t size, const char *format,...)
 Format and print data to a buffer with limited buffer size. More...
 
int vprintf (const char *format, va_list ap)
 Format and print data to the standard output with argument list. More...
 
int vfprintf (FILE *stream, const char *format, va_list ap)
 Format and print data to a file with argument list. More...
 
int vdprintf (int fd, const char *format, va_list ap)
 Format and print data to a file with argument list. More...
 
int vsprintf (char *str, const char *format, va_list ap)
 Format and print data to a buffer with argument list. More...
 
int vsnprintf (char *str, size_t size, const char *format, va_list ap)
 Format and print data to a buffer with limited size and argument list. More...
 

Variables

FILEstdin
 
FILEstdout
 
FILEstderr
 

Function Documentation

◆ dprintf()

int dprintf ( int  fd,
const char *  format,
  ... 
)

Format and print data to a file.

Parameters
strThe pointer to the print buffer.
formatFormat string.
...Print arguments.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.

◆ fclose()

int fclose ( FILE stream)

Close the given file stream.

Parameters
streamThe file stream to provide.
Return values
int0 on success and nonzero error number on error.

◆ fileno()

int fileno ( FILE stream)

Examine the argument stream and returns the integer file descriptor used to implement this stream.

Parameters
streamThe file stream to provide.
Return values
intThe file descriptor integer.

◆ fopen()

FILE* fopen ( const char *  pathname,
const char *  mode 
)

Open the file whose name is the string pointed to by pathname and associate a stream with it.

Parameters
pathnameThe pathname of the file to open.
modeNot used.
Return values
FILE*: File stream object.

◆ fprintf()

int fprintf ( FILE stream,
const char *  format,
  ... 
)

Format and print data to a file.

Parameters
streamThe pointer to the file stream.
formatFormat string.
...Print arguments.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.

◆ fread()

size_t fread ( void *  ptr,
size_t  size,
size_t  nmemb,
FILE stream 
)

Read nmemb items of data, each size bytes long, from the stream pointed to by stream, storing them at the location given by ptr.

Parameters
ptrThe memory space for storing the read data.
sizeThe number of nmemb bytes to read.
nmembThe bytes number to read at once.
streamThe file stream to provide.
Return values
intThe read number on success and nonzero error number on error.

◆ fseek()

int fseek ( FILE stream,
long  offset,
int  whence 
)

Set the file position indicator for the stream pointed to by stream.

Parameters
streamThe file stream to provide.
offsetThe new offset to the position specified by whence.
whenceThe start position of the new offset.
Return values
intThe new file position on success and nonzero error number on error.

◆ fwrite()

size_t fwrite ( const void *  ptr,
size_t  size,
size_t  nmemb,
FILE stream 
)

Write nmemb items of data, each size bytes long, to the stream pointed to by stream, obtaining them from the location given by ptr.

Parameters
ptrThe data to write to the file.
sizeThe number of nmemb bytes to write.
nmembThe byte number to write at once.
streamThe file stream to provide.
Return values
intThe write number on success and nonzero error number on error.

◆ printf()

int printf ( const char *  format,
  ... 
)

Format and print data to the standard output.

Parameters
formatFormat string.
...Print arguments.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.

◆ snprintf()

int snprintf ( char *  str,
size_t  size,
const char *  format,
  ... 
)

Format and print data to a buffer with limited buffer size.

Parameters
strThe pointer to the print buffer.
sizeThe size of the buffer.
formatFormat string.
...Print arguments.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.

◆ sprintf()

int sprintf ( char *  str,
const char *  format,
  ... 
)

Format and print data to a buffer.

Parameters
strThe pointer to the print buffer.
formatFormat string.
...Print arguments.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.

◆ vdprintf()

int vdprintf ( int  fd,
const char *  format,
va_list  ap 
)

Format and print data to a file with argument list.

Parameters
fd: File descriptor number.
formatFormat string.
apArgument list.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.

◆ vfprintf()

int vfprintf ( FILE stream,
const char *  format,
va_list  ap 
)

Format and print data to a file with argument list.

Parameters
streamThe pointer to the file stream.
formatFormat string.
apArgument list.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.

◆ vprintf()

int vprintf ( const char *  format,
va_list  ap 
)

Format and print data to the standard output with argument list.

Parameters
formatFormat string.
apArgument list.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.

◆ vsnprintf()

int vsnprintf ( char *  str,
size_t  size,
const char *  format,
va_list  ap 
)

Format and print data to a buffer with limited size and argument list.

Parameters
strThe pointer to the print buffer.
sizeThe size of the buffer.
formatFormat string.
apArgument list.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.

◆ vsprintf()

int vsprintf ( char *  str,
const char *  format,
va_list  ap 
)

Format and print data to a buffer with argument list.

Parameters
strThe pointer to the print buffer.
sizeThe size of the buffer.
formatFormat string.
apArgument list.
Return values
Uponsuccessful return, the function returns the number of characters printed; otherwie a negative value is returned.