Computer Science, asked by sayalidoshi315, 6 days ago

Write a program to read data from the keyboard, write it to a file called INPUT, again read the same data from the INPUT file, and display it on the screen.​

Answers

Answered by jayant182
3

Answer:

#include<stdio.h>

#include<file.h>

main()

{

FILE *f1,*f2;

char c;

printf(“data input\n\n”)

f1 = fopen(“INPUT”, “w”);

while((c = getchar())!=EOF)

putc(c,f1);

fclose(f1);

printf(“\ndata output\n\n”)

f1 = fopen(“INPUT”, “r”);

while((c = getchar())!=EOF)

putc(“%c”,c);

fclose(f1);

//copying f f1 data into f2

f1=fopen(file1,”r”)

if(f1=NULL)

{

printf(“no data”);

exit(0):

}

f2=fopen(file2,”w”);

if(f2=null)

{

printf(“cannot able to open”);

exit(0);

}

while((ch==getc(f1)!=EOF)

putc(ch,f2);

printf(“completed”);

fclose(f1);

fclose(f2);

}

c

file-io

input

output

Share

Follow

Similar questions
Math, 8 months ago