Chapter - 13: File Input-Output

While using the statement, fp = fopen ( "myfile.c", "r" ) ; what happens if


B
Sections
6
Exercises

- 'myfile.c' does not exist on the disk
- 'myfile.c' exists on the disk


Ans:

1. If "myfile.c" exist in the disk, so simple FILE pointer fp points to the file.

2. If "myfile.c" do not exist in the disk, so as the opening mode is "r" read-only, so no new file is created and fopen() returns a NULL assigned to fp.


© 2021 Garbage Valuegarbage value logo