#include <stdarg.h>
#include <stddef.h>
#include <sys/types.h>
Go to the source code of this file.
|
#define | SEEK_CUR 1 |
| Seek postition is relative to current position im file.
|
|
#define | SEEK_END 2 |
| Seek position is relative to end of file.
|
|
#define | SEEK_SET 3 |
| Seek position is relative to beginning of file.
|
|
#define | EOF -1 |
| Represents EOF.
|
|
|
FILE * | fopen (char *filename, char *mode) |
|
int | fgetc (FILE *stream) |
|
int | getc (FILE *stream) |
|
char * | fgets (char *str, int count, FILE *stream) |
|
char * | gets (char *str) |
|
size_t | fread (void *buffer, size_t size, size_t count, FILE *stream) |
|
int | fputc (int c, FILE *stream) |
|
int | putc (int c, FILE *stream) |
|
int | fputs (const char *s, FILE *stream) |
|
size_t | fwrite (void *buffer_ptr, size_t size, size_t count, FILE *stream) |
|
int | puts (const char *s) |
|
int | fprintf (FILE *stream, const char *format,...) |
|
int | vfprintf (FILE *stream, const char *format, va_list arg) |
|
int | printf (const char *format,...) |
|
int | fseek (FILE *stream, long offset, int origin) |
|
long | ftell (FILE *stream) |
|
int | fclose (FILE *file) |
|
int | feof (FILE *stream) |
|
int | ferror (FILE *stream) |
|
int | fflush (FILE *stream) |
|
void | setbuf (FILE *restrict stream, char *restrict buf) |
|
void | register_fs (const char *name, pid_t pid) |
|
int | mount (char *file, char *type, char *path) |
|
◆ fclose()
int fclose |
( |
FILE * |
file | ) |
|
Closes a file
- Parameters
-
- Returns
- 0 on success, EOF on failure
◆ feof()
int feof |
( |
FILE * |
stream | ) |
|
Returns the EOF indicator for a file
- Parameters
-
- Returns
- the EOF indicator
◆ ferror()
int ferror |
( |
FILE * |
stream | ) |
|
Returns the error indicator for a file
- Parameters
-
- Returns
- the error indicator
◆ fflush()
int fflush |
( |
FILE * |
stream | ) |
|
Flushes the buffer on a file
- Parameters
-
stream | The file to flush the buffer of |
- Returns
- 0 on success, EOF on failure
◆ fgetc()
int fgetc |
( |
FILE * |
stream | ) |
|
Gets a character from a file
- Parameters
-
stream | The file to read from |
- Returns
- the read character, or EOF if the read fails
◆ fgets()
char* fgets |
( |
char * |
str, |
|
|
int |
count, |
|
|
FILE * |
stream |
|
) |
| |
Gets a newline delimeted string from a file
- Parameters
-
str | The buffer to read into |
count | The maximum size of the string to read |
stream | The file to read from |
- Returns
- the buffer
◆ fopen()
FILE* fopen |
( |
char * |
filename, |
|
|
char * |
mode |
|
) |
| |
Opens a file with the specified mode
- Parameters
-
filename | The path to the file to open |
mode | The mode to open the file with (r,w,a,r+,w+,a+) |
- Returns
- NULL if the file could not be opened, or a pointer to a FILE struct if the opening was sucessful.
◆ fprintf()
int fprintf |
( |
FILE * |
stream, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
Format a string and writte it to a file
- Parameters
-
stream | The fike to write to |
format | The format string |
... | The arguments for the format string |
- Returns
- The number of bytes written
◆ fputc()
int fputc |
( |
int |
c, |
|
|
FILE * |
stream |
|
) |
| |
Writes a character to a file
- Parameters
-
c | The character to write |
stream | The stream to write to |
- Returns
- the written character, or EOF on failure
◆ fputs()
int fputs |
( |
const char * |
s, |
|
|
FILE * |
stream |
|
) |
| |
Writes a string to a file
- Parameters
-
s | The string to write |
stream | The file to write to |
- Returns
- 0 on success, EOF on failure
◆ fread()
size_t fread |
( |
void * |
buffer, |
|
|
size_t |
size, |
|
|
size_t |
count, |
|
|
FILE * |
stream |
|
) |
| |
Reads from a file
- Parameters
-
buffer | The buffer to read into |
size | The size of each elemnt to read |
count | The number of elements to read |
stream | The file to read from |
- Returns
- the number of bytes read, or 0 on failure
◆ fseek()
int fseek |
( |
FILE * |
stream, |
|
|
long |
offset, |
|
|
int |
origin |
|
) |
| |
Seeks to a position in a file
- Parameters
-
stream | The file to seek in |
offset | The offset to seek to |
origin | The origin of seeking (SEEK_CUR,SEEK_END,SEEK_SET) |
- Returns
- 0 on success, -1 on failure
◆ ftell()
long ftell |
( |
FILE * |
stream | ) |
|
Returns the postion in a file
- Parameters
-
stream | The file to get the position in |
- Returns
- the position on success, -1 on failure
◆ fwrite()
size_t fwrite |
( |
void * |
buffer_ptr, |
|
|
size_t |
size, |
|
|
size_t |
count, |
|
|
FILE * |
stream |
|
) |
| |
Writes to a file
- Parameters
-
buffer_ptr | The buffer to write |
size | The size of each elemnt to write |
count | The number of elements to write |
stream | The file to write to |
- Returns
- the number of bytes written, or 0 on failure
◆ getc()
int getc |
( |
FILE * |
stream | ) |
|
Gets a character from a file
- Parameters
-
stream | The file to read from |
- Returns
- the read character, or EOF if the read fails
◆ gets()
Gets a newline delimeted string from stdin
- Parameters
-
str | The buffer to read into |
- Returns
- the buffer
- Deprecated:
- Gets is unsafe and vulnerable to a buffer overflow, as there is no bounds checking on the buffer.
◆ mount()
int mount |
( |
char * |
file, |
|
|
char * |
type, |
|
|
char * |
path |
|
) |
| |
Mounts a filesystem
- Parameters
-
file | The file to mount |
type | The type of the filesystem to mount |
path | The path to mount the filesytem at |
- Returns
- 0 on success, 1 on failure
◆ printf()
int printf |
( |
const char * |
format, |
|
|
|
... |
|
) |
| |
Format a string and write it to stdout
- Parameters
-
format | The format string |
... | The arguments for the format string |
- Returns
- The number of bytes written
◆ putc()
int putc |
( |
int |
c, |
|
|
FILE * |
stream |
|
) |
| |
Writes a character to a file
- Parameters
-
c | The character to write |
stream | The stream to write to |
- Returns
- the written character, or EOF on failure
◆ puts()
int puts |
( |
const char * |
s | ) |
|
Writes a string followed by a newline to stdin
- Parameters
-
- Returns
- 0 on success, EOF on failure
◆ register_fs()
void register_fs |
( |
const char * |
name, |
|
|
pid_t |
pid |
|
) |
| |
Registers a file system type with the VFS
- Parameters
-
name | The name of the type to register |
pid | The PID of the filesytem driver |
◆ setbuf()
void setbuf |
( |
FILE *restrict |
stream, |
|
|
char *restrict |
buf |
|
) |
| |
Assigns buffering to a file
When the buffer is not a null pointer, the buffer type is set to fully bufferd, and the buffer size is assumed to be at least BUFSIZ.
When the buffer is a null pointer, buffering is removed.
- Parameters
-
stream | The file to assign buffering to |
buf | The buffer to use |
◆ vfprintf()
int vfprintf |
( |
FILE * |
stream, |
|
|
const char * |
format, |
|
|
va_list |
arg |
|
) |
| |
Format a string and writte it to a file
- Parameters
-
stream | The fike to write to |
format | The format string |
arg | The arguments for the format string |
- Returns
- The number of bytes written