Folks, I'm trying to copy a file that has multiple products, one line with the name and the following with the code, price, and quantity. I tried to pass each line to a vector, but it is not working. When I print, it is not correct.
fp = fopen("Produtos.txt","r");
if ((fp = fopen("Produtos.txt","r")) == NULL ){
printf("Erro na abertura do arquivo!!!!");
return (0);
}
while (1){
if(feof(fp)) break;
fgets(nome_prod[i],100,fp);
fgets(cod_prod[i],100,fp);
fscanf(fp,"%f",&preco_prod[i]);
fscanf(fp,"%d",&quant_prod[i]);
i++;}