Thursday, April 25, 2013

Given a text file, create another text file deleting the following words “three”, “bad”, and “time”.

4:13 PM


#include<stdio.h>
#include<conio.h>
void main()
{
   FILE *fp;
   char str;
   fp=fopen("old.txt","r+");
   clrscr();
   while(fscanf(fp,"%s",str)!=EOF)
   {
      if(strcmp(str,"three")==0||strcmp(str,"bad")==0||strcmp(str,"time")==0)
      {
         printf("");
      }
    else
        printf("%s ",str);

 }
fclose(fp);
getch();
}

Note: Create a text file old.txt in same folder and write some words including three, bad and time.

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

 

© 2013 TechSansar. All rights resevered. Designed by Templateism

Back To Top