Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ler ()
- {
- system("cls");
- //variaveis
- char nome_loja[25];
- int limite_estoque;
- int i;
- //abertura arquivo para testes de print
- FILE *saida_estoque;
- saida_estoque = fopen ("saida_estoque.txt", "w+");
- //abertura arquivo
- FILE *estoque;
- estoque = fopen("estoque.txt", "r+");
- if (saida == NULL)
- {
- printf("Arquivo nao encontrado.");
- }
- if (estoque == NULL)
- {
- printf("Arquivo nao encontrado.");
- }
- fscanf (estoque, "%s", &nome_loja);
- fflush (stdin);
- fscanf (estoque, "%d", &numero_itens);
- fscanf (estoque, "%d", &limite_estoque);
- //alocação na struct
- for(i=0; i<numero_itens; i++)
- {
- fscanf (estoque, "%d %s %s %d %d %f", ®[i].id, ®[i].nome, ®[i].fabricante, ®[i].quantidade, ®[i].lucro, ®[i].preco );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment