FOPEN()

FILE *file = fopen("filename.txt", "r");
fclose()

 * the "FILE" keyword is an alias for a struct that holds information about a file 
   stream such as buffer location, current position, mode ("r", "w", etc.), and error 
   state.
    - it is a typedef alias defined in the standard C library (stdio.h)
       - typedef struct _IO_FILE FILE;
    - think of FILE *file as a "file handle" — like a remote control that lets you 
      interact with a TV (the file), but not the TV itself.
 * the filename must exists in the working directory
    - provide full path if required
       -if the file doesn't exist or can't be opened, fopen() returns NULL
 * r represents read mode

Last updated