Then I ran a search and found these two functions that promise to delete and rename files, it happens when trying to use them or erase or rename the files, I tried a lot of it, but nothing worked, even when I go to see output of the functions, instead of returning zero return -1. If anyone can help I would be very grateful!
Thank you in advance!
void copia_arquivo(FILE *file1, FILE *file2, char cpf[15])
{
char confirma_nome2[15];
char confirma_ultimoNome2[15];
char confirma_dataNasc2[11];
char confirma_cpf2[15];
int confirma_numero2;
while (fscanf(file1, "%s %s %s %i %s", confirma_nome2, confirma_ultimoNome2, confirma_dataNasc2, &confirma_numero2, confirma_cpf2) != EOF)
{
if (strstr(cpf, confirma_cpf2) == 0)
{
fprintf(file2, "%s %s %s %i %s\n", confirma_nome2, confirma_ultimoNome2, confirma_dataNasc2, confirma_numero2, confirma_cpf2);
}
}
fclose(file1);
fclose(file2);
remove("clientes\client.txt");
rename("clientes\client2.txt", "clientes\client.txt");
}