Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- int main(){
- char word[500];
- FILE *fp;
- int c;
- int i=0;
- int k=0;
- fp = fopen("test.txt", "r");
- c = getc(fp);
- while(c != EOF){
- if(isalpha(c)) {
- word[i] = c;
- i++;
- k++;
- printf("Tecknet รคr %c \n", c);
- }
- if(c == 10) {
- if(k == 0) {
- printf("Radbrytning \n");
- }
- if(k>0) {
- ungetc(c, fp);
- k=0;
- printf("Lagra i word \n");
- }
- }
- word[i] = '\0';
- return 1;
- c = getc(fp);
- }
- return 0;
- fclose(fp);
- }
Add Comment
Please, Sign In to add comment