Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 18th, 2012  |  syntax: None  |  size: 0.89 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void wyswietl(unsigned int ilosc) {
  2.         long int i,j;
  3.         FILE * fhandle;
  4.         CD plyta;
  5.         printf("\t\t>> Wyswietlam plyty cd... \n");
  6.         fhandle = fopen("cd.dat", "rb");
  7.         if(fhandle == NULL) {
  8.                 printf("Nie mozna otworzyc pliku!");
  9.                 return;
  10.         }
  11.         for(i=0; i<ilosc; ++i) {
  12.                 fread(&plyta,sizeof(plyta),1,fhandle);
  13.                 printf("\t#%d\n\tTytul: %s\n",i+1, plyta.tytul);
  14.                 printf("\tWykonawca: %s\n",plyta.nazwisko);
  15.                 printf("\tWydawca: %s\n",plyta.wydawca);
  16.                 printf("\tRok: %d\n",plyta.rok);
  17.                 printf("\tCena: %lf\n",plyta.cena);
  18.                 printf("\tIlosc utworow: %d\n",plyta.ilosc);
  19.                 for(j=0; j<plyta.ilosc; ++j) {
  20.                         printf("\t\t#%d - Autor: %s\n",j+1,plyta.utwory[j].autor);
  21.                         printf("\t\t     Wykonawca: %s\n",plyta.utwory[j].wykonwaca);
  22.                         printf("\t\t     Czas trwania: %dm %ds\n",(unsigned int)(plyta.utwory[j].czas / 60),plyta.utwory[j].czas % 60);
  23.                 }
  24.                 printf("\n");
  25.                 _getch();
  26.         }
  27.         fclose(fhandle);
  28. }