Advertisement
Guest User

Untitled

a guest
Apr 8th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. int main() {
  5.     char c;
  6.     int i=-1, ar=0, sb=0, se, fl=0, j;
  7.     FILE *f;
  8.     f = fopen("in.txt","r");
  9.     if (!f) {printf("Erro occuring opening file"); return 1; }
  10.     while(!feof(f)) {
  11.         i++;
  12.         c = fgetc(f);
  13.         if (!isalpha(c) && !fl) continue; else {fl=1;sb=i;}
  14.         if (c == '!' || c == '?' || c == '.') {
  15.             se = i;
  16.             for(j=sb;j<se;j++) {
  17.                 fseek(f,j,0);
  18.                 c = fgetc(f);
  19.                 printf("%c",c);
  20.             }
  21.             fseek(f,i,0);
  22.             sb = se + 2;
  23.         }
  24.     }
  25.     fclose(f);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement