#include<stdio.h>
#include<conio.h>
#include<process.h>
void main(){
FILE *file;
char ch;
clrscr();
file=fopen("C:\\text.txt", "w");
if(file==NULL){
printf("File can't be opened!");
exit(0);
}
while((ch=getchar())!='\n')
fputc(ch, file);
fclose(file);
getch();
}
#include<conio.h>
#include<process.h>
void main(){
FILE *file;
char ch;
clrscr();
file=fopen("C:\\text.txt", "w");
if(file==NULL){
printf("File can't be opened!");
exit(0);
}
while((ch=getchar())!='\n')
fputc(ch, file);
fclose(file);
getch();
}
Comments