C File Handling Functions
C File Handling Functions
1. fopen()
Definition: Opens a file and returns a file pointer (FILE *). If the file doesn't exist, it can create it
(depending on mode).
2. fclose()
Example: fclose(fp);
3. fgetc()
4. fgets()
Definition: Reads a string (line) from the file until a newline or EOF is reached.
6. fputs()
7. fscanf()
Definition: Reads formatted input from the file (similar to scanf but from a file).
8. fprintf()
9. feof()
Definition: Returns true (non-zero) if the end of the file has been reached.
Syntax: int feof(FILE *stream);
10. ferror()
11. rewind()
Example: rewind(fp);
Output: Moves the file pointer back to the start of the file.
12. ftell()
13. fseek()