I'm reading products from a binary file. When I'm reading these products, I'm also counting the repetition of same products. At the end,I'm listing products and their numbers.
void product_counting_listing(FILE *fileptr)
{
Product p;
while(!feof(fileptr))
{
    fread(&p.p_code,sizeof(Product),1,fileptr);
    ??
}
rewind(fileptr);
while(!feof(fileptr)){
    printf("Product Code  Number of Product\n");
    printf("-------- --------");
    fread(&p.p_code,sizeof(Product),1,fileptr);
    printf("%d %d",p.p_code,?)
}
Any ideas for counting the same Products and listing them?
 
     
     
    