Files

Created by Miroslav Biňas / mirek

## Files
## What is file?
> In C programming, file is a place on your physical disk where information is stored. ([www.programiz.com](https://www.programiz.com/c-programming/c-file-input-output))
## Why Files are Needed?
## Types of Files
## MIME Type (Multipurpose Internet Mail Extensions)
## Types of Files * text files * binary files
FILE *fopen(const char *pathname,
            const char *mode);
FILE *fp
File access mode Meaning Explanation File already exists File does not exist
"r" read open file for reading read from start failure to open
"w" write create file for writing destroy contents create new
"a" append append to file write to end create new
"r+" read extended open file for read/write read from start error
"w+" write extended create file for read/write destroy contents create new
"a+" append extended open file for read/write write to end create new
int fgetc(FILE *stream);
## `EOF`
int fseek(FILE *stream,
          long offset,
          int whence);
long ftell(FILE *stream);
int fprintf(FILE *stream,
            const char *format,
            ...);
int fscanf(FILE *stream,
           const char *format,
           ...);
## Buffer Overflow
size_t fread(void *ptr,
             size_t size,
             size_t nmemb,
             FILE *stream);
size_t fwrite(const void *ptr,
              size_t size,
              size_t nmemb,
              FILE *stream);
## Binary Files
## Questions?