Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Rodrigo Padres - V00938933 - December 1st, 2019
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- int main() {
- FILE* input_file = fopen("input_text.txt", "r");
- FILE* copy_file = fopen("copy.txt", "w");
- char ch;
- while((ch = fgetc(input_file)) != EOF){
- if(isalpha(ch) || ch == '\'' || ch == '-' || ch == '\n'){
- fprintf(copy_file,"%c", ch);
- }else{
- ch = ' ';
- fprintf(copy_file,"%c", ch);
- }
- }
- fclose(input_file);
- fclose(copy_file);
- char word[100];
- FILE*copy_file_read = fopen("copy.txt", "r");
- while(fscanf(copy_file_read, "%s", word) == 1){
- printf("Word (%d characters): %s\n",strlen(word), word);
- }
- fclose(copy_file_read);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement