BORUTO-121

extractTextFromhtml

Sep 17th, 2021
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main(){
  4.   FILE* ulaz=fopen("index.html","r");
  5.   FILE* izlaz=fopen("index.txt","w");
  6.   if(ulaz==NULL){
  7.     printf("Datoteka index.html ne postoji");
  8.     return 0;
  9.   }
  10.  
  11.   int c;
  12.   while((c=fgetc(ulaz))!=EOF){
  13.     if(c=='<')
  14.       for(;c!=EOF && c!='>';c=fgetc(ulaz));
  15.     else if(c=='&')
  16.       for(;c!=EOF && c!=';';c=fgetc(ulaz));
  17.     else
  18.       fputc(c,izlaz);
  19.   }
  20.   fclose(ulaz);
  21.   fclose(izlaz);
  22.   return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment