#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
FILE *fp;
char ch;
if(!(fp=fopen("sample.txt","w")))
{
printf("error in opening the file");
getch();
exit (1);
}
while((ch=getchar())!=EOF)
{
putc(ch,fp);
}
fclose(fp);
getch();
return 0;
}
#include<stdlib.h>
#include<conio.h>
int main()
{
FILE *fp;
char ch;
if(!(fp=fopen("sample.txt","w")))
{
printf("error in opening the file");
getch();
exit (1);
}
while((ch=getchar())!=EOF)
{
putc(ch,fp);
}
fclose(fp);
getch();
return 0;
}
No comments:
Post a Comment