0

I'm new to the forum and I have a problem with this part of my program. What I want to do is a function where every two words of the file you open put 3 dots in front of the word and I don't see where I have the error.

void frase_lenta1(char frase[MAX_F][MAX_C], char frase2[MAX_F][MAX_C])
{
    char caracter;
    int i, j, cont_p, n;
    char fitx; //Nom del fitxer
    FILE* fit;

    n = cont_p % 2;
    cont_p = 0;
    for (i = 0; i < MAX_F; i++) {
        fit = fopen(fitx, "r");
        for (j = 0; j < MAX_C; j++) {
            while (frase[i][j] != '.' && frase[i][j] != '\0') {
                if (frase[i][j] == ' ') {
                    cont_p++;
                }
                if (n == 0) {
                    frase2[i][j] = frase[i][j];
                    frase2[i][j] = '.';
                    frase2[i][j + 1] = '.';
                    frase2[i][j + 2] = '.';
                }
            }
        }

        while ((caracter = fgetc(fit)) != EOF) {
            printf("%c", caracter);
        }
    }
}
mch
  • 9,424
  • 2
  • 28
  • 42

0 Answers0