Computer Science, asked by egnkjvb, 1 year ago

how can text be read from the keyboard?

Answers

Answered by Shivaya1
0

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

void main()
{
FILE *fp;
char ch,file[10];
clrscr();
printf(“Enter file name:”);
scanf(“%s”,file);

fp=fopen(file,”w”);   //file opening
if(fp==NULL)   //exit program if file doesn’t open
{
printf(“File could not open!!”);
exit(0);
}

printf(“Enter data(* to exit)n”);
while(1)
{
ch=getche();
if(ch==’*’)      //exit when * is pressed
exit(0);
putc(ch,fp);

}

fclose(fp);   //file closing
}

Answered by mfaizan19
0
sorry i dont know i will ansewr you when i will knowing it


Similar questions