Which statement correctly establishes a file pointer? file quake: File *QUAKE: F
ID: 3858649 • Letter: W
Question
Which statement correctly establishes a file pointer? file quake: File *QUAKE: FILE *quake: file *quake: To read in 200 lines in a file with a control number, it is best to use a while loop in C. True False What is the C command used to open a data file? fopenf open openf fopen The three modes of opening a file in C are read, write, and append. True False In C, 10 read in data from an external file at file path C: Desktopmy_data.txt to file pointer myfile (assume this has been declared), which statement should be used? myfile = open(degree C: \Desktop\my_data.txt", "r");Explanation / Answer
Question 37:
Which statement correctly establishes a file pointer?
Answer :
FILE *quake;
Explanation:
In C programming working with files , we need to declare a pointer of a type file. This declaration is used for communciation between the file and program.
Syntax : FILE *fptr;
Question 38
To read in 200 lines in a file with a control number , it is best to use a while loop in C.
Answer:
Yes
Explanation :
Yes we can use while loop to read in 200 lines in a file with a control number.
Question 39
What is the C command used to open a data file?
Answer:
fopen
Expalanation :
To open a file in C : opening a file is using fopen()
Syntax : fp = fopen(“fileopen” , “mode”)
For example fopen(“C:\cprogram\abc.txt”,”w”);
Question 40 :
The three modes of opening a file in C are read , write , and append.
Answer :
Yes
Exaplanation :
File can be opened in basic three modes : read , write and append mode. If file is not present on the path specified then new file can be created using write and append mode.
Examples :
Reading mode : fp = fopen(“abc.txt”,”r”);
Writing mode : fp = fopen(“abc.txt”,”w”);
Append mode : fp = fopen(“abc.txt”,”a”);
Question 40
In C , to read in data from an external file path C:\Desktopmy_data.txt to file pointer myfile (assume this has been declared), which statement should be used?
Answer:
Myfile = fopen(“C:\Desktopmy_data.txt” , “r”);
Expalanation :
The above file is in read mode . it is read in data from an external file path C:\Desktopmy_data.txt.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.