Computer Science, asked by tehrankhan143, 8 months ago

write a program to store & display multiple integers in & from a binary file.​

Answers

Answered by jiyapatel1207
0

Answer:

A Simple C Program to open, read and close the file

#include <stdio.h>

int main()

{

/* Pointer to the file */

FILE *fp1;

/* Character variable to read the content of file */

char c;

/* Opening a file in r mode*/

fp1= fopen ("C:\\myfiles\\newfile.txt", "r");

/* Infinite loop –I have used break to come out of the loop*/

while(1)

{

c = fgetc(fp1);

if(c==EOF)

break;

else

printf("%c", c);

}

fclose(fp1);

return 0;

}

In the above program, we are opening a file newfile.txt in r mode, reading the content of the file and displaying it on the console. lets understand the each operation in detail:

Similar questions