wap in c to read contents from a file
Answers
Answered by
3
C O D E
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *file;
char c;
file = fopen("brainly.txt", "r"); // enter the name of file.
while (1)
{
if (file == NULL)
{
printf("File Not Found\n");
exit(0);
}
else
{
c = fgetc(file);
if (c == EOF)
{
break;
}
printf("%c", c);
}
}
fclose(file);
}
Attachments:
Similar questions
Chemistry,
12 days ago
Psychology,
12 days ago
English,
12 days ago
Social Sciences,
24 days ago
Science,
24 days ago
Physics,
8 months ago