- It creates a new file for use
- Open an existing file for use
- It include file name, data structure, and mode (purpose)
- File name is string of characters that make up a valid file name for the operating system.
- The file name may contain two parts, first primary name and second is optional part, second part is extension part like as help.txt, program.c etc.
- The data structure of a file is defined as FILE in the library of standard I/O function definitions.
- All files should be declared as type FILE before they are used.
- The FILE is a defined data type.
- The mode or purpose means what we do with the file.
Syntax:
FILE *file_pointer;
file_pointer
= fopen (“ file_name”, “ mode”);
ex:
FILE*fp;
fp
= fopen (“help”,”w”);
No comments:
Post a Comment