home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / bbs / dlp100.zip / FGFA.C < prev    next >
C/C++ Source or Header  |  1993-06-23  |  2KB  |  66 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "ra.h"
  4.  
  5. main()
  6. {
  7. char Path[128];
  8. char WorkName[41];
  9. char Line[80];
  10.  
  11. unsigned int GroupNum=0, AreaNum=0;
  12. int i, j;
  13.  
  14. struct GROUP FGroupRec;
  15. struct FILES FilesRec;
  16.  
  17. RAEnvr = getenv("RA");
  18. strcpy (Path, RAEnvr);
  19. strcat (Path, "\\FGROUPS.RA");
  20.  
  21. if((FGROUP_RA=fopen(Path,"rb"))==NULL)
  22.    { printf("\n\nUnable to open %s!\n", Path);
  23.      getch();
  24.      return(1);
  25.    }
  26. strcpy (Path, RAEnvr);
  27. strcat (Path, "\\FILES.RA");
  28.  
  29. if((FILES_RA=fopen(Path,"rb"))==NULL)
  30.    { printf("\n\nUnable to open %s!\n", Path);
  31.      getch();
  32.      return(1);
  33.    }
  34.  
  35. while(fread(&FGroupRec, sizeof(FGroupRec), 1, FGROUP_RA)==1)
  36.  { GroupNum++;
  37.    if(FGroupRec.NameSize)
  38.    { strncpy (WorkName, FGroupRec.Name, FGroupRec.NameSize);
  39.      WorkName[FGroupRec.NameSize]='\0';
  40.      fprintf(stdout, "%5u\) %-40s\n", GroupNum, WorkName);
  41.      fseek(FILES_RA, 0, SEEK_SET);
  42.      AreaNum=0;
  43.      fprintf (stdout, "%s %-40s %s\n", "       File ", "Name", " Group  Alt1  Alt2  Alt3");
  44.      while(fread(&FilesRec, sizeof(FilesRec), 1, FILES_RA)==1)
  45.        { AreaNum++;
  46.      if(FilesRec.FilePathSize)
  47.        if(GroupNum == FilesRec.Group       ||
  48.           GroupNum == FilesRec.AltGroup[0] ||
  49.           GroupNum == FilesRec.AltGroup[1] ||
  50.           GroupNum == FilesRec.AltGroup[2])
  51.           { strncpy (WorkName, FilesRec.Name, FilesRec.NameSize);
  52.         WorkName[FilesRec.NameSize]='\0';
  53.         fprintf(stdout, "     %5u\)  %-40s  %5u %5u %5u %5u\n",
  54.                             AreaNum, WorkName,
  55.                             FilesRec.Group,
  56.                             FilesRec.AltGroup[0],
  57.                             FilesRec.AltGroup[1],
  58.                             FilesRec.AltGroup[2]);
  59.           }
  60.        }
  61.    }
  62.  }
  63. fclose(FGROUP_RA);
  64. fclose(FILES_RA);
  65. }
  66.