Repeat the vowel Problem 3 (0 / 0)

Write a program that will repeat k times each single occurrence of a vowel in the input file "sp.txt" to a new file "output.txt". The first line of the input file contains only the parameter k. The first line (containing the parameter k) should not to be written in the output file.

hi guys. I wrote the code but i cant figure out something. i read the file, i found the vowels but then i cant print them. can anyone help me ?


Code:
#include <stdio.h>#include <string.h>
#include <ctype.h>
#define MAX 100


int checkvowel(char c)
{
    if(c=='A' || c=='a' || c=='E' || c=='e' || c=='o' || c=='O' || c=='u' || c=='U' || c=='i' || c=='I')
        return 1;
    else
        return 0;
}


void wtf() {
    FILE *f = fopen("sp.txt", "w");
    char c;
    while((c = getchar()) != EOF) {
        fputc(c, f);
    }
    fclose(f);
}
void rff() {
    FILE *f = fopen("output.txt", "r");
    char c;
    while((c = fgetc(f)) != EOF) {
        putchar(c);
    }
    fclose(f);
}


int main() {
    wtf();
    int k;
    char b[100];
    scanf("%d",&k);
    FILE *f1;
    FILE *f2;
    f1=fopen("output.txt","r");
        if(f1==NULL)
    {
    printf("WE CANT OPEN THE FILE");
        return -1;
    }
    
    char c[100];
    int z=0,i;
    while(fgets(c,100,f1))
    {
    for(i=0; i<strlen(c); i++)
    {
    if(isalpha(c[i]))
    {
    if(checkvowel(c[i]))
    {
   for(i=0; i<k; i++)
   {
   b[z]=c[i];
       z++;
   }
    }
    if(!(checkvowel(c[i])))
    {
    b[z]=c[i];
    z++;
    }
    }
    else
        b[z]=c[i];
        z++;
    }
    }
    
    fclose(f1);
    
  f2=fopen("sp.txt","w");
        if(f1==NULL)
    {
    printf("WE CANT OPEN THE FILE");
        return -1;
    }
    
    
    
    
    rff();
    return 0;
	
}