Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main (void)
- {
- FILE *fp;
- FILE *fp1;
- FILE *fp2;
- char words[30];
- char size[30];
- char *ptr;
- char *ptr1;
- int counter;
- fp = fopen("wordsgr.txt","r");
- fp1 = fopen("wordssize.txt","r");
- fp2 = fopen("dictionary.txt","w");
- while(1)
- {
- ptr = fgets(words,30,fp);
- ptr1 = fgets(size,30,fp1);
- if (ptr == NULL || ptr1 == NULL)
- {
- break;
- }
- /*will search for newline character in string 1(size) and replace it with the terminating character \0 */
- if (size[strlen(size)-1] == '\n')
- {
- size[strlen(size)-1] = '.';
- size[strlen(size)] = '\0';
- }
- strcat(ptr1,ptr);
- printf("%s",ptr1);
- fprintf(fp2,"%s",ptr1);
- }
- printf("\a");
- fclose(fp);
- fclose(fp1);
- fclose(fp2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement