i am using this program to read string from a file and removing vowels from it. But i am having problems with writing the new string in the file!
please help me. I am using Turbo C/C++ IDE
Code:
/* vowel_remover.c */
#include<stdio.h>
#include<conio.h>
#define not_vowel(ch) (ch!='A'||ch!='a'||ch!='E'||ch!='e'||ch!='I'||ch!='i'||ch!='O'||ch!='o'||ch!='U'||ch!='u')
void main(void)
{
FILE *fp;
char ch;
fp=fopen("F:/Testfile.txt","a+");
if(fp==NULL)printf("file not found");
while(1)
{
ch=fgetc(fp);
if(ch==EOF)break;
putch(ch);
if(not_vowel(ch))
fprintf(fp,"%c",ch);
}
fclose(fp);
getch();
}