home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Misc / GMS / GMSDev / Source / C / Files / Files.c next >
Encoding:
C/C++ Source or Header  |  1997-12-16  |  1.7 KB  |  60 lines

  1. /* Dice: dcc -l0 -mD dpk.o Files.c -o Files
  2. **
  3. ** Run this demo with the IceBreaker debug program and observe the output.
  4. */
  5.  
  6. #include <proto/dpkernel.h>
  7. #include <misc/time.h>
  8. #include <system/debug.h>
  9.  
  10. extern APTR FILBase;
  11.  
  12. BYTE *ProgName      = "Files";
  13. BYTE *ProgAuthor    = "Paul Manias";
  14. BYTE *ProgDate      = "10 October 1997";
  15. BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1997.  Freely distributable.";
  16. BYTE *ProgShort     = "File demo.";
  17.  
  18. void main(void)
  19. {
  20.   struct Directory *dir = NULL;
  21.   struct FileName  loc  = { ID_FILENAME, "GMS:System/" };
  22.   struct Directory *tdir;
  23.   struct File      *tfile;
  24.  
  25.    if (dir = InitTags(NULL,
  26.        TAGS_DIRECTORY, NULL,
  27.        DIRA_Source,     &loc,
  28.        TAGEND)) {
  29.  
  30.       if (Activate(dir) IS ERR_OK) {
  31.          DPrintF("Directory activated, now printing dir/file list.");
  32.  
  33.          /* WriteComment(dir,"Testing WriteComment() in GMS."); */
  34.  
  35.          tdir = dir->ChildDir;
  36.          while (tdir) {
  37.             DPrintF("Dir:  %s  Date: %d/%d/%d", tdir->Source->Name, tdir->Date->Day, tdir->Date->Month, tdir->Date->Year);
  38.             tdir = tdir->Next;
  39.          }
  40.  
  41.          tfile = dir->ChildFile;
  42.          while (tfile) {
  43.             DPrintF("File: %s Date: %d/%d/%d", ((struct FileName *)tfile->Source)->Name, tfile->Date->Day, tfile->Date->Month, tfile->Date->Year);
  44.             if (tfile->Comment) {
  45.                DPrintF("Comment: %s  Permission Flags: $%x", tfile->Comment, tfile->Permissions);
  46.             }
  47.             else {
  48.                DPrintF("Permission Flags: $%x", tfile->Permissions);
  49.             }
  50.             tfile = tfile->Next;
  51.          }
  52.       }
  53.       else EMsg("Sorry, could not successfully activate the directory.");
  54.    }
  55.    else EMsg("Could not initialise directory object.");
  56.  
  57.    Free(dir);
  58. }
  59.  
  60.