Sai_Bot

func_ler

Jun 7th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. void ler ()
  2. {
  3.     system("cls");
  4.     //variaveis
  5.     char nome_loja[25];
  6.     int limite_estoque;
  7.     int i;
  8.    
  9.     //abertura arquivo para testes de print
  10.     FILE *saida_estoque;
  11.     saida_estoque = fopen ("saida_estoque.txt", "w+");
  12.    
  13.     //abertura arquivo
  14.     FILE *estoque;
  15.     estoque = fopen("estoque.txt", "r+");
  16.    
  17.     if (saida == NULL)
  18.     {
  19.         printf("Arquivo nao encontrado.");
  20.     }
  21.     if (estoque == NULL)
  22.     {
  23.         printf("Arquivo nao encontrado.");
  24.     }
  25.    
  26.     fscanf (estoque, "%s", &nome_loja);
  27.     fflush (stdin);
  28.    
  29.     fscanf (estoque, "%d", &numero_itens);
  30.    
  31.     fscanf (estoque, "%d", &limite_estoque);
  32.    
  33.     //alocação na struct
  34.     for(i=0; i<numero_itens; i++)
  35.     {
  36.         fscanf (estoque, "%d %s %s %d %d %f", &reg[i].id, &reg[i].nome, &reg[i].fabricante, &reg[i].quantidade, &reg[i].lucro, &reg[i].preco );
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment