summarizing what I'm doing, I'm carrying out a supermarket management project. in which I have to make a list saved in a txt file for the clients and products, and I'm confused because it worked on the clients, but on the products it is encrypted.
I imagine that the problem is in the code that I am going to put here. this is the structure of the products
typedef struct _produto{
    int ID;
    char nome[10];
    float preco;
    int validade;
    int quantidade;
    struct _produto* next;
} Produto; 
this is a procedure that will ask the values to user
void adicionarP(Produto* listaProduto) {
    Produto* novoProduto = (Produto*)calloc(1, sizeof(Produto));
    int auxInt = -1;
    float auxF = -1;
    
    printf("Digite o nome do produto: ");
    fflush(stdin); 
    fgets(novoProduto->nome, 10, stdin);
    novoProduto->nome[strcspn(novoProduto->nome, "\n")] = 0; // tira a nova linha "\n" que tenho no nome
    
    novoProduto->ID= obterIdAleatorioP(listaProduto);
    
    printf("Digite o preco do produto:");
    scanf("%f", &auxF);
    fflush(stdin);
    novoProduto->preco = auxF;
    auxInt = -1;
    printf("Digite a validade do produto:");
    scanf("%d", &auxInt);
    fflush(stdin);
    novoProduto->validade = auxInt;
    
    auxInt = -1;
    printf("Digite a Quantidade do stock:");
    scanf("%d", &auxInt);
    fflush(stdin);
    novoProduto->quantidade = auxInt;
    
    listaProduto = adicionarProduto(listaProduto, novoProduto);
    printf("\nAdicionado com sucesso!\n");
}
in the procedure above there are two functions, one called "adicionarProduto" that will basically see the list and when null will add the new product
Produto* adicionarProduto(Produto *listaProduto, Produto *novoProduto)
{
    if(listaProduto == NULL) return novoProduto;
    listaProduto->next = adicionarProduto(listaProduto->next, novoProduto);
    return listaProduto;
}
the function obterIdAleatorioP will generate a random id
int obterIdAleatorioP(Produto* listaProdutos) {
    int randomId;
    time_t t;
    srand((unsigned) time(&t));
    
    do {
        randomId = rand() % 10; 
    } while(existeProduto(listaProdutos,randomId));
    
    return randomId;
}
before doing any function(example: the function in the top) txt file:
1:IceCream:2.00:123:321
after doin any function txt file:
11802128:IceCream:2.00:123:321:0.000000:11802152:11802148
11825056::0.000000:11825080:11825076
11802176:pe:0.000000:11802200:11802196
 
    