/* Listing #1 */ #include #include #include #include #include #include int main(int argc, char *argv[]) { struct IntuitionBase *IntuitionBase; struct GfxBase *GfxBase; struct Library *MathTransBase; struct Library *lib; /* Próba otwarcia "intuition.library" (z ROMu) */ IntuitionBase=(struct IntuitionBase*)OpenLibrary("intuition.library", 0); if (IntuitionBase) printf("Udaîo sië otworzyê bibliotekë Intuition z ROMu.\n"); /* Spróbujmy otworzyê kolejnâ. Uwaga: skrót myôlowy rodem z C */ if (GfxBase=(struct GfxBase*)OpenLibrary("graphics.library", 0)) printf("Z ubolewaniem stwierdzam, ûe udaîo siëÚotworzyê bibliotekë graficznâ.\n"); /* Spróbujmy z jakâô bibliotekâ dyskowâ */ if (MathTransBase=OpenLibrary("mathtrans.library", 0)) printf("Udaîo sië otworzyê coô z dysku. To coô to \"mathtrans.library\".\n"); /* Spróbujmy otworzyê coô, czego po prostu nie ma */ if (lib=OpenLibrary("nieznana_biblioteka.library", 0)) printf("Takiej biblioteki w ûyciu byômy sië nie spodziewali.\n"); /* Nie wiemy co to i skâd, ale zamknâê trzeba bëdzie */ else printf("Skoro takiej biblioteki nie ma, to nic dziwnego, ûe sië nie udaîo jej otworzyê.\n"); /* Jeôli udaîo sië "coô" otworzyê, to równieû naleûaîo by to "coô" zamknâê */ if (IntuitionBase) CloseLibrary((struct Library*)IntuitionBase); if (GfxBase) CloseLibrary((struct Library*)GfxBase); if (MathTransBase) CloseLibrary(MathTransBase); if (lib) /* Co prawda takiej biblioteki nie znamy, ale skoro jest, to równieû naleûy jâ zamknâê */ CloseLibrary(lib); return 0; }