HPE
Company
Programming
file *fp;
fp=fopen("/home/ts/test.txt","r");
Which of the following code is correct about the code?
A)the code will write test.txt in /home/ts
B)the code will open test.txt for reading in text mode
C)The code will open the /home directory and create test.txt in it
D)The code will open only read only files of home directory.
Read Solution (Total 2)
-
- b is the answer. Fp is the file pointer and fopen helps you open the file test.txt.
home/ts/test.txt this is the path for reaching test.txt file and "r" is for opening the file in read mode. - 8 years agoHelpfull: Yes(2) No(0)
- The answer is B. The function 'fopen' opens the file 'text.txt' in 'r' mode or the reading mode. Since the file has an extension of '.txt', the file is a text file.
- 5 years agoHelpfull: Yes(0) No(0)
HPE Other Question