|
ginnOS
The reference: libc, the libraries and the kernel
|
buffered streams and formatted input/output. More...
Go to the source code of this file.
Macros | |
| #define | NULL ((void *)0) |
| #define | EOF (-1) |
| #define | BUFSIZ 1024 |
| #define | FILENAME_MAX 256 |
| #define | _IOFBF 0 |
| #define | _IOLBF 1 |
| #define | _IONBF 2 |
| #define | SEEK_SET 0 |
| #define | SEEK_CUR 1 |
| #define | SEEK_END 2 |
Typedefs | |
| typedef struct stdio_file | FILE |
| typedef off_t | fpos_t |
Functions | |
| FILE * | fopen (const char *path, const char *mode) |
| FILE * | fdopen (int fd, const char *mode) |
| int | fclose (FILE *stream) |
| int | fflush (FILE *stream) |
| FILE * | freopen (const char *path, const char *mode, FILE *stream) |
| give a stream another file: the old file is closed, the stream keeps its fd number (so freopen on stdin or stdout changes fd 0 or 1). | |
| FILE * | tmpfile (void) |
| a new file for reading and writing that goes when it is closed (it is made in /tmp and removed at once). | |
| FILE * | popen (const char *command, const char *mode) |
| run "sh -c command" with a pipe to its standard output ("r") or from its standard input ("w"). | |
| int | pclose (FILE *stream) |
| close a stream of popen and wait for the command. | |
| int | setvbuf (FILE *stream, char *buf, int mode, size_t size) |
| void | setbuf (FILE *stream, char *buf) |
| int | fileno (FILE *stream) |
| size_t | fread (void *ptr, size_t size, size_t count, FILE *stream) |
| size_t | fwrite (const void *ptr, size_t size, size_t count, FILE *stream) |
| int | fgetc (FILE *stream) |
| int | getc (FILE *stream) |
| int | getchar (void) |
| int | ungetc (int c, FILE *stream) |
| char * | fgets (char *buf, int size, FILE *stream) |
| int | fputc (int c, FILE *stream) |
| int | putc (int c, FILE *stream) |
| int | putchar (int c) |
| int | fputs (const char *s, FILE *stream) |
| int | puts (const char *s) |
| int | fseek (FILE *stream, long offset, int whence) |
| long | ftell (FILE *stream) |
| int | fseeko (FILE *stream, off_t offset, int whence) |
| off_t | ftello (FILE *stream) |
| int | fgetpos (FILE *stream, fpos_t *pos) |
| int | fsetpos (FILE *stream, const fpos_t *pos) |
| void | rewind (FILE *stream) |
| int | feof (FILE *stream) |
| int | ferror (FILE *stream) |
| void | clearerr (FILE *stream) |
| int | printf (const char *fmt,...) __attribute__((format(printf |
| formatted output. | |
| int int | fprintf (FILE *stream, const char *fmt,...) __attribute__((format(printf |
| int int int | dprintf (int fd, const char *fmt,...) __attribute__((format(printf |
| int int int int | sprintf (char *buf, const char *fmt,...) __attribute__((format(printf |
| int int int int int | snprintf (char *buf, size_t size, const char *fmt,...) __attribute__((format(printf |
| int int int int int int | vprintf (const char *fmt, va_list ap) |
| int | vfprintf (FILE *stream, const char *fmt, va_list ap) |
| int | vdprintf (int fd, const char *fmt, va_list ap) |
| int | vsprintf (char *buf, const char *fmt, va_list ap) |
| int | vsnprintf (char *buf, size_t size, const char *fmt, va_list ap) |
| int | sscanf (const char *str, const char *fmt,...) |
| formatted input from a string: d i u x o c s %[...] n and %%, with widths and the lengths hh h l ll z. | |
| int | rename (const char *old_path, const char *new_path) |
| rename a file or directory (on the same filesystem). | |
| int | renameat (int old_dirfd, const char *old_path, int new_dirfd, const char *new_path) |
| int | remove (const char *path) |
| remove a file or an empty directory. | |
| void | perror (const char *s) |
| write "s: " (when s is not NULL or empty) and the text of errno to stderr (in errno.c; errno.h declares it too). | |
| void | flockfile (FILE *stream) |
| int | ftrylockfile (FILE *stream) |
| void | funlockfile (FILE *stream) |
| int | getc_unlocked (FILE *stream) |
| int | getchar_unlocked (void) |
| int | putc_unlocked (int c, FILE *stream) |
| int | putchar_unlocked (int c) |
| ssize_t | getline (char **line, size_t *size, FILE *stream) |
| read a line, with its newline, into *line (made larger with realloc as it needs; *line may be NULL and *size 0 at first). | |
| ssize_t | getdelim (char **line, size_t *size, int delimiter, FILE *stream) |
| as getline, up to and with delimiter instead of a newline | |
| FILE * | fmemopen (void *memory, size_t size, const char *mode) |
| a stream on size bytes of memory (or on new memory, freed by fclose, when memory is NULL). | |
Variables | |
| FILE * | stdin |
| FILE * | stdout |
| FILE * | stderr |
buffered streams and formatted input/output.
a FILE buffers the bytes of one file descriptor. a stream on a terminal is written out at the end of every stdio call (so printf and write calls stay in order); other streams are written out when the buffer is full, by fflush, by fclose, and by exit (not by _exit).
| #define NULL ((void *)0) |
| #define EOF (-1) |
| #define BUFSIZ 1024 |
| #define FILENAME_MAX 256 |
| #define _IOFBF 0 |
| #define _IOLBF 1 |
| #define _IONBF 2 |
| #define SEEK_SET 0 |
| #define SEEK_CUR 1 |
| #define SEEK_END 2 |
| typedef struct stdio_file FILE |
| FILE * fopen | ( | const char * | path, |
| const char * | mode ) |
| FILE * fdopen | ( | int | fd, |
| const char * | mode ) |
| int fclose | ( | FILE * | stream | ) |
| int fflush | ( | FILE * | stream | ) |
give a stream another file: the old file is closed, the stream keeps its fd number (so freopen on stdin or stdout changes fd 0 or 1).
| path | the new file; NULL keeps the file and changes only the mode. |
| FILE * tmpfile | ( | void | ) |
a new file for reading and writing that goes when it is closed (it is made in /tmp and removed at once).
| FILE * popen | ( | const char * | command, |
| const char * | mode ) |
run "sh -c command" with a pipe to its standard output ("r") or from its standard input ("w").
| int pclose | ( | FILE * | stream | ) |
close a stream of popen and wait for the command.
| void setbuf | ( | FILE * | stream, |
| char * | buf ) |
| int fileno | ( | FILE * | stream | ) |
| int fgetc | ( | FILE * | stream | ) |
| int getc | ( | FILE * | stream | ) |
| int getchar | ( | void | ) |
| int ungetc | ( | int | c, |
| FILE * | stream ) |
| char * fgets | ( | char * | buf, |
| int | size, | ||
| FILE * | stream ) |
| int fputc | ( | int | c, |
| FILE * | stream ) |
| int putc | ( | int | c, |
| FILE * | stream ) |
| int putchar | ( | int | c | ) |
| int fputs | ( | const char * | s, |
| FILE * | stream ) |
| int puts | ( | const char * | s | ) |
| int fseek | ( | FILE * | stream, |
| long | offset, | ||
| int | whence ) |
| long ftell | ( | FILE * | stream | ) |
| void rewind | ( | FILE * | stream | ) |
| int feof | ( | FILE * | stream | ) |
| int ferror | ( | FILE * | stream | ) |
| void clearerr | ( | FILE * | stream | ) |
| int printf | ( | const char * | fmt, |
| ... ) |
formatted output.
conversions: d i u o x X c s p n f F e E g G %; flags - + space # 0; a width and a precision (also as *); lengths hh h l ll z j t L.
| int int fprintf | ( | FILE * | stream, |
| const char * | fmt, | ||
| ... ) |
| int int int dprintf | ( | int | fd, |
| const char * | fmt, | ||
| ... ) |
| int int int int sprintf | ( | char * | buf, |
| const char * | fmt, | ||
| ... ) |
| int int int int int snprintf | ( | char * | buf, |
| size_t | size, | ||
| const char * | fmt, | ||
| ... ) |
| int int int int int int vprintf | ( | const char * | fmt, |
| va_list | ap ) |
| int vdprintf | ( | int | fd, |
| const char * | fmt, | ||
| va_list | ap ) |
| int vsprintf | ( | char * | buf, |
| const char * | fmt, | ||
| va_list | ap ) |
| int sscanf | ( | const char * | str, |
| const char * | fmt, | ||
| ... ) |
formatted input from a string: d i u x o c s %[...] n and %%, with widths and the lengths hh h l ll z.
| int rename | ( | const char * | old_path, |
| const char * | new_path ) |
rename a file or directory (on the same filesystem).
| int renameat | ( | int | old_dirfd, |
| const char * | old_path, | ||
| int | new_dirfd, | ||
| const char * | new_path ) |
| int remove | ( | const char * | path | ) |
remove a file or an empty directory.
| void perror | ( | const char * | s | ) |
write "s: " (when s is not NULL or empty) and the text of errno to stderr (in errno.c; errno.h declares it too).
| void flockfile | ( | FILE * | stream | ) |
| int ftrylockfile | ( | FILE * | stream | ) |
| void funlockfile | ( | FILE * | stream | ) |
| int getc_unlocked | ( | FILE * | stream | ) |
| int getchar_unlocked | ( | void | ) |
| int putc_unlocked | ( | int | c, |
| FILE * | stream ) |
| int putchar_unlocked | ( | int | c | ) |
read a line, with its newline, into *line (made larger with realloc as it needs; *line may be NULL and *size 0 at first).
as getline, up to and with delimiter instead of a newline
a stream on size bytes of memory (or on new memory, freed by fclose, when memory is NULL).
reads stop at the content's end; writes stop at size and keep a null byte after the content while there is room.
|
extern |
|
extern |
|
extern |