1
I have this data structure:
typedef struct
{
    ListaCartao tabelaCartao[HASHSIZE];
    ListaArtigos tabelaArtigos[HASHSIZE];
    char localidade[MAXLOCALIZACAO];
}tCelulaSuperdume, *SuperDume;
SuperDume superMercadoLocal[CONJUNTOSUPERDUME];
char localSuperDume[MAXLOCALIZACAO];
int indiceLocalSuperDume = 0;
Within SuperDume I have two Hash tables. Then I try to save one SuperDume file and I can’t:
void EscreveFicheiro(char nomeFich[])
{
    FILE* f;
    if (fopen_s(&f, nomeFich, "wb") == NULL)
        printf("Erro");
    else
    {
        SuperDume aux;
        for (i = 0; i < CONJUNTOSUPERDUME; i++)
        {
            aux = superMercadoLocal[indiceLocalSuperDume];          
            fwrite(&aux, sizeof(SuperDume) * CONJUNTOSUPERDUME,1,f);
        }
        fclose(f);
    }
}
The file opens, only it can’t do the fwrite, returning me the following error:

Edited. I have the following code
void EscreveFicheiroCartoes(char nomeFich[])
{
    FILE* f;
    if (fopen_s(&f, nomeFich, "wb") == NULL)
        printf("Erro");
    ListaCartao aux;
    for (i = 0; i < HASHSIZE; i++)
    {
        aux = superMercadoLocal[indiceLocalSuperDume]->tabelaCartao[i];
        if (aux == NULL)
            continue;
        else
        {
            while (aux != NULL)
            {
                fwrite(&(aux), sizeof(ListaCartao), 1, f);
                aux = aux->proximo;
            }
        }
    }
    fclose(f); 
}
Thank you, I thought the safe shape of the fopen works the same way as the fopen. But even so, I cannot write the structure in file, just write me a character : 'è' , nothing more
– Quim Cardoso