home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1997 #3 / amigamamagazinepolishissue03-1 / ma_1995 / 05 / ami044a.txt < prev    next >
Text File  |  1997-04-07  |  2KB  |  111 lines

  1. /* Listing #1 */
  2.  
  3.  
  4.  
  5. #include <proto/exec.h>
  6.  
  7. #include <proto/intuition.h>
  8.  
  9. #include <proto/graphics.h>
  10.  
  11. #include <proto/mathtrans.h>
  12.  
  13.  
  14.  
  15. #include <stdio.h>
  16.  
  17. #include <stdlib.h>
  18.  
  19.  
  20.  
  21. int main(int argc, char *argv[])
  22.  
  23. {
  24.  
  25.     struct IntuitionBase *IntuitionBase;
  26.  
  27.     struct GfxBase *GfxBase;
  28.  
  29.     struct Library *MathTransBase;
  30.  
  31.     struct Library *lib;
  32.  
  33.  
  34.  
  35.     /* Próba otwarcia "intuition.library" (z ROMu) */
  36.  
  37.     IntuitionBase=(struct IntuitionBase*)OpenLibrary("intuition.library", 0);
  38.  
  39.  
  40.  
  41.     if (IntuitionBase)
  42.  
  43.         printf("Udaîo sië otworzyê bibliotekë Intuition z ROMu.\n");
  44.  
  45.  
  46.  
  47.     /* Spróbujmy otworzyê kolejnâ. Uwaga: skrót myôlowy rodem z C */
  48.  
  49.     if (GfxBase=(struct GfxBase*)OpenLibrary("graphics.library", 0))
  50.  
  51.         printf("Z ubolewaniem stwierdzam, ûe udaîo siëÚotworzyê bibliotekë graficznâ.\n");
  52.  
  53.  
  54.  
  55.     /* Spróbujmy z jakâô bibliotekâ dyskowâ */
  56.  
  57.     if (MathTransBase=OpenLibrary("mathtrans.library", 0))
  58.  
  59.         printf("Udaîo sië otworzyê coô z dysku. To coô to \"mathtrans.library\".\n");
  60.  
  61.  
  62.  
  63.     /* Spróbujmy otworzyê coô, czego po prostu nie ma */
  64.  
  65.     if (lib=OpenLibrary("nieznana_biblioteka.library", 0))
  66.  
  67.         printf("Takiej biblioteki w ûyciu byômy sië nie spodziewali.\n");
  68.  
  69.         /* Nie wiemy co to i skâd, ale zamknâê trzeba bëdzie */
  70.  
  71.     else
  72.  
  73.         printf("Skoro takiej biblioteki nie ma, to nic dziwnego, ûe sië nie udaîo jej otworzyê.\n");
  74.  
  75.  
  76.  
  77.     /* Jeôli udaîo sië "coô" otworzyê, to równieû naleûaîo by to "coô" zamknâê */
  78.  
  79.  
  80.  
  81.     if (IntuitionBase)
  82.  
  83.         CloseLibrary((struct Library*)IntuitionBase);
  84.  
  85.  
  86.  
  87.     if (GfxBase)
  88.  
  89.         CloseLibrary((struct Library*)GfxBase);
  90.  
  91.  
  92.  
  93.     if (MathTransBase)
  94.  
  95.         CloseLibrary(MathTransBase);
  96.  
  97.  
  98.  
  99.     if (lib)
  100.  
  101.         /* Co prawda takiej biblioteki nie znamy, ale skoro jest, to równieû naleûy jâ zamknâê */
  102.  
  103.         CloseLibrary(lib);
  104.  
  105.  
  106.  
  107.     return 0;
  108.  
  109. }
  110.  
  111.