Tizen RT Libs&Environment  v1.1 D4

Provides APIs for Standard Input/Output. More...

Collaboration diagram for STDIO:

Files

file  stdio.h
 Standard Input / Output APIs.
 

Macros

#define FILENAME_MAX   _POSIX_NAME_MAX
 
#define BUFSSIZ   64
 
#define _IOFBF   0 /* Fully buffered */
 
#define _IOLBF   1 /* Line buffered */
 
#define _IONBF   2 /* Unbuffered */
 
#define EOF   (-1)
 
#define stdin   (&sched_getstreams()->sl_streams[0])
 
#define stdout   (&sched_getstreams()->sl_streams[1])
 
#define stderr   (&sched_getstreams()->sl_streams[2])
 
#define putc(c, s)   fputc((c), (s))
 put a byte on a stream More...
 
#define putchar(c)   fputc(c, stdout)
 put a byte on a stdout stream More...
 
#define getc(s)   fgetc(s)
 get a byte from a stream More...
 
#define getchar()   fgetc(stdin)
 get a byte from a stdin stream More...
 
#define CONFIG_LIBC_TMPDIR   "/tmp"
 
#define P_tmpdir   CONFIG_LIBC_TMPDIR
 
#define CONFIG_LIBC_MAX_TMPFILE   32
 
#define L_tmpnam   CONFIG_LIBC_MAX_TMPFILE
 
#define TMP_MAX   56800235584ull
 
#define EXTERN   extern
 

Typedefs

typedef struct file_struct FILE
 

Functions

int fclose (FAR FILE *stream)
 close a stream More...
 
int fflush (FAR FILE *stream)
 flush a stream More...
 
int feof (FAR FILE *stream)
 test end-of-file indicator on a stream More...
 
int ferror (FAR FILE *stream)
 test error indicator on a stream More...
 
int fileno (FAR FILE *stream)
 map a stream pointer to a file descriptor More...
 
int fgetc (FAR FILE *stream)
 get a byte from a stream More...
 
int fgetpos (FAR FILE *stream, FAR fpos_t *pos)
 get current file position information More...
 
char * fgets (FAR char *s, int n, FAR FILE *stream)
 get a string from a stream More...
 
FAR FILEfopen (FAR const char *path, FAR const char *type)
 open a stream More...
 
FAR FILEfreopen (FAR const char *path, FAR const char *mode, FAR FILE *stream)
 open a stream More...
 
void setbuf (FAR FILE *stream, FAR char *buf)
 assign buffering to a stream More...
 
int setvbuf (FAR FILE *stream, FAR char *buffer, int mode, size_t size)
 assign buffering to a stream More...
 
int fprintf (FAR FILE *stream, FAR const char *format,...)
 print formatted output More...
 
int fputc (int c, FAR FILE *stream)
 put a byte on a stream More...
 
int fputs (FAR const char *s, FAR FILE *stream)
 put a string on a stream More...
 
size_t fread (FAR void *ptr, size_t size, size_t n_items, FAR FILE *stream)
 binary input More...
 
int fseek (FAR FILE *stream, long int offset, int whence)
 reposition a file-position indicator in a stream More...
 
int fsetpos (FAR FILE *stream, FAR fpos_t *pos)
 set current file position More...
 
long ftell (FAR FILE *stream)
 return a file offset in a stream More...
 
size_t fwrite (FAR const void *ptr, size_t size, size_t n_items, FAR FILE *stream)
 binary output More...
 
FAR char * gets (FAR char *s)
 get a string from a stdin stream More...
 
FAR char * gets_s (FAR char *s, rsize_t n)
 reads a line from stdin into the buffer More...
 
int ungetc (int c, FAR FILE *stream)
 push byte back into input stream More...
 
int printf (FAR const char *format,...)
 print formatted output More...
 
int puts (FAR const char *s)
 put a string on standard output More...
 
int sprintf (FAR char *buf, FAR const char *format,...)
 print formatted output More...
 
int asprintf (FAR char **ptr, FAR const char *fmt,...)
 print formatted output More...
 
int snprintf (FAR char *buf, size_t size, FAR const char *format,...)
 print formatted output More...
 
int sscanf (FAR const char *buf, FAR const char *fmt,...)
 convert formatted input More...
 
void perror (FAR const char *s)
 write error messages to standard error More...
 
int vprintf (FAR const char *format, va_list ap)
 format output of a stdarg argument list More...
 
int vfprintf (FAR FILE *stream, const char *format, va_list ap)
 format output of a stdarg argument list More...
 
int vsprintf (FAR char *buf, const char *format, va_list ap)
 format output of a stdarg argument list More...
 
int vsnprintf (FAR char *buf, size_t size, const char *format, va_list ap)
 format output of a stdarg argument list More...
 
int vsscanf (FAR const char *buf, FAR const char *s, va_list ap)
 format input of a stdarg argument list More...
 
FAR FILEfdopen (int fd, FAR const char *type)
 associate a stream with a file descriptor More...
 

Detailed Description

Provides APIs for Standard Input/Output.

Macro Definition Documentation

◆ _IOFBF

#define _IOFBF   0 /* Fully buffered */

Definition at line 102 of file stdio.h.

◆ _IOLBF

#define _IOLBF   1 /* Line buffered */

Definition at line 103 of file stdio.h.

◆ _IONBF

#define _IONBF   2 /* Unbuffered */

Definition at line 104 of file stdio.h.

◆ BUFSSIZ

#define BUFSSIZ   64

Definition at line 97 of file stdio.h.

◆ CONFIG_LIBC_MAX_TMPFILE

#define CONFIG_LIBC_MAX_TMPFILE   32

Definition at line 168 of file stdio.h.

◆ CONFIG_LIBC_TMPDIR

#define CONFIG_LIBC_TMPDIR   "/tmp"

Definition at line 160 of file stdio.h.

◆ EOF

#define EOF   (-1)

Definition at line 108 of file stdio.h.

◆ EXTERN

#define EXTERN   extern

Definition at line 194 of file stdio.h.

◆ FILENAME_MAX

#define FILENAME_MAX   _POSIX_NAME_MAX

Definition at line 90 of file stdio.h.

◆ getc

#define getc (   s)    fgetc(s)

get a byte from a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

Definition at line 140 of file stdio.h.

◆ getchar

#define getchar ( )    fgetc(stdin)

get a byte from a stdin stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

Definition at line 147 of file stdio.h.

◆ L_tmpnam

#define L_tmpnam   CONFIG_LIBC_MAX_TMPFILE

Definition at line 171 of file stdio.h.

◆ P_tmpdir

#define P_tmpdir   CONFIG_LIBC_TMPDIR

Definition at line 163 of file stdio.h.

◆ putc

#define putc (   c,
 
)    fputc((c), (s))

put a byte on a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

Definition at line 126 of file stdio.h.

◆ putchar

#define putchar (   c)    fputc(c, stdout)

put a byte on a stdout stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

Definition at line 133 of file stdio.h.

◆ stderr

#define stderr   (&sched_getstreams()->sl_streams[2])

Definition at line 114 of file stdio.h.

◆ stdin

#define stdin   (&sched_getstreams()->sl_streams[0])

Definition at line 112 of file stdio.h.

◆ stdout

#define stdout   (&sched_getstreams()->sl_streams[1])

Definition at line 113 of file stdio.h.

◆ TMP_MAX

#define TMP_MAX   56800235584ull

Definition at line 175 of file stdio.h.

Typedef Documentation

◆ FILE

typedef struct file_struct FILE

Definition at line 183 of file stdio.h.

Function Documentation

◆ asprintf()

int asprintf ( FAR char **  ptr,
FAR const char *  fmt,
  ... 
)

print formatted output

#include <stdio.h>
This function is similar to sprintf, except that it dynamically allocates a string (as with malloc) to hold the output, instead of putting the output in a buffer you allocate in advance. The ptr argument should be the address of a char * object, and a successful call to asprintf stores a pointer to the newly allocated string at that location.

Returns
The returned value is the number of characters allocated for the buffer, or less than zero if an error occurred. Usually this means that the buffer could not be allocated.
Since
Tizen RT v1.0

◆ fclose()

int fclose ( FAR FILE stream)

close a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fdopen()

FAR FILE* fdopen ( int  fd,
FAR const char *  type 
)

associate a stream with a file descriptor

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ feof()

int feof ( FAR FILE stream)

test end-of-file indicator on a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ ferror()

int ferror ( FAR FILE stream)

test error indicator on a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fflush()

int fflush ( FAR FILE stream)

flush a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fgetc()

int fgetc ( FAR FILE stream)

get a byte from a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fgetpos()

int fgetpos ( FAR FILE stream,
FAR fpos_t *  pos 
)

get current file position information

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fgets()

char* fgets ( FAR char *  s,
int  n,
FAR FILE stream 
)

get a string from a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fileno()

int fileno ( FAR FILE stream)

map a stream pointer to a file descriptor

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fopen()

FAR FILE* fopen ( FAR const char *  path,
FAR const char *  type 
)

open a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fprintf()

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

print formatted output

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fputc()

int fputc ( int  c,
FAR FILE stream 
)

put a byte on a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fputs()

int fputs ( FAR const char *  s,
FAR FILE stream 
)

put a string on a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fread()

size_t fread ( FAR void *  ptr,
size_t  size,
size_t  n_items,
FAR FILE stream 
)

binary input

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ freopen()

FAR FILE* freopen ( FAR const char *  path,
FAR const char *  mode,
FAR FILE stream 
)

open a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.1

◆ fseek()

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

reposition a file-position indicator in a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fsetpos()

int fsetpos ( FAR FILE stream,
FAR fpos_t *  pos 
)

set current file position

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ ftell()

long ftell ( FAR FILE stream)

return a file offset in a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ fwrite()

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

binary output

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ gets()

FAR char* gets ( FAR char *  s)

get a string from a stdin stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ gets_s()

FAR char* gets_s ( FAR char *  s,
rsize_t  n 
)

reads a line from stdin into the buffer

#include <stdio.h>
gets() reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF, which it replaces with '\0'. Reads at most n-1 characters from stdin into the array pointed to by str until new-line character, end-of-file condition, or read error. The newline character, if encountered, is not saved in the arraay. A NUL character is written immediately after the last character read into the array, or to str[0] if no characters were read.

If n is zero or is greater than RSIZE_MAX, a null character is written to str[0] but the function reads and discards characters from stdin until new-line character, end-of-file condition, or read error (not implemented).

If n-1 characters have been read, continues reading and discarding the characters from stdin until new-line character, end-of-file condition, or read error.

Parameters
[out]sbuffer to save string from stdin
[in]nsize of string to save
Returns
On success, a pointer of buffer is returned. On failure, NULL is returned.
Since
Tizen RT v1.0

◆ perror()

void perror ( FAR const char *  s)

write error messages to standard error

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ printf()

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

print formatted output

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ puts()

int puts ( FAR const char *  s)

put a string on standard output

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ setbuf()

void setbuf ( FAR FILE stream,
FAR char *  buf 
)

assign buffering to a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.1

◆ setvbuf()

int setvbuf ( FAR FILE stream,
FAR char *  buffer,
int  mode,
size_t  size 
)

assign buffering to a stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.1

◆ snprintf()

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

print formatted output

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ sprintf()

int sprintf ( FAR char *  buf,
FAR const char *  format,
  ... 
)

print formatted output

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ sscanf()

int sscanf ( FAR const char *  buf,
FAR const char *  fmt,
  ... 
)

convert formatted input

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ ungetc()

int ungetc ( int  c,
FAR FILE stream 
)

push byte back into input stream

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ vfprintf()

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

format output of a stdarg argument list

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ vprintf()

int vprintf ( FAR const char *  format,
va_list  ap 
)

format output of a stdarg argument list

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ vsnprintf()

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

format output of a stdarg argument list

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ vsprintf()

int vsprintf ( FAR char *  buf,
const char *  format,
va_list  ap 
)

format output of a stdarg argument list

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0

◆ vsscanf()

int vsscanf ( FAR const char *  buf,
FAR const char *  s,
va_list  ap 
)

format input of a stdarg argument list

#include <stdio.h>
POSIX API (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)

Since
Tizen RT v1.0