PRF192_-_SU_2024_-_Block_5_-_FE_2675.webp
R

PRF192_-_SU_2024_-_Block_5_-_FE_2675.webp

Kizspy | Question: 45
(Choose 1 answer)
Consider the following code snippet that reads and prints the contents of a text file named "data.txt":
#include <stdio.h>
int main() {
FILE *file ptr;
char ch;
file_ptr = fopen("data.txt", "r");
if ( file_ptr == NULL) {
printf("Unable to open the file.\n");
return 1;
}
while ((ch = fgetc(file_ptr)) != EOF) { printf("%c", ch);
}
fclose(file_ptr);
return 0;
FUOVER
}
What will be the output of this code when executed, assuming "data.txt" contains the following text:
Hello
This is a sample text file.
A. Hello
This is a sample text file.
B. Hello
C. This is a sample text file.
D. This is a sample text file.Hello

Thông tin

Category
PRF192
Thêm bởi
respectful_man
Ngày thêm
Lượt xem
2,002
Lượt bình luận
4
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom