Table of Contents
show
- A file can be opened using built – in fopen( ) function
- It is present in stdio.h library file of C
- The file should be exist in the same directory as C program files else full path name has to be specified as file name
- The fopen() function takes two parameters; filename and mode
Syntax
fopen
FILE *fopen(const char *filename, const char *mode)
Parameters
filename − This is the C string containing the name of the file to be opened.
mode − This is the C string containing a file access mode.
Return Value
This function returns a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error.
Access mode
Views: 0