Chapter - 13: File Input-Output

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


B
Sections
6
Exercises

A

B

C

1

2

3

4

5

6

7

8

9

- '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.


© 2020 Garbage Valuegarbage value logo