#include<stdio.h>
#include<conio.h>
void main(){
FILE *fp;
char msg[100];
int i=0;
clrscr();
printf("Enter a string \n");
gets(msg);
fp=fopen("xyz.txt","r+");
if (fp==NULL){
printf("opration failed!!\n");
getch();
exit(0);
}
while (msg[i]!=NULL){
fputc(msg[i],fp);
i=i+1;
}
//fgets(msg,100,fp);
getch();
fclose(fp);
}
#include<conio.h>
void main(){
FILE *fp;
char msg[100];
int i=0;
clrscr();
printf("Enter a string \n");
gets(msg);
fp=fopen("xyz.txt","r+");
if (fp==NULL){
printf("opration failed!!\n");
getch();
exit(0);
}
while (msg[i]!=NULL){
fputc(msg[i],fp);
i=i+1;
}
//fgets(msg,100,fp);
getch();
fclose(fp);
}
No comments:
Post a Comment