home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 580a.lha / HDFView_v3.01 / source.LZH / source / src / getFilename.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-03  |  1.4 KB  |  54 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3. #include <string.h>
  4. #include <libraries/asl.h>
  5.  
  6. #include <proto/asl.h>
  7.  
  8. extern struct FileRequester *MyFileReqStruct;
  9.  
  10. extern struct Window *gWindow;
  11.  
  12. struct TagItem RequestTags[] = 
  13. {
  14.    {ASL_Hail,NULL},
  15.    {ASL_Window,NULL},
  16.    {ASL_File,NULL},
  17.    {ASL_Dir,NULL},
  18.    {ASL_Pattern,NULL},
  19.    {ASL_FuncFlags,FILF_PATGAD},
  20.    {ASL_TopEdge, 1},
  21.    {ASL_LeftEdge,0},       
  22.    {ASL_Height,199}, 
  23.    {ASL_Width,300},       
  24.    {TAG_DONE,NULL}
  25. };                     
  26.  
  27. char *getFilename(char *file, char *dir, char *title, char *ext)
  28. {
  29.       static char fullname[81];
  30.       BOOL ret;
  31.       RequestTags[0].ti_Data = (ULONG)title;
  32.       RequestTags[1].ti_Data = (ULONG)gWindow;
  33.       RequestTags[2].ti_Data = (ULONG)file;
  34.       RequestTags[3].ti_Data = (ULONG)dir;
  35.       RequestTags[4].ti_Data = (ULONG)ext;
  36.    
  37.        MyFileReqStruct = AllocAslRequest(ASL_FileRequest, RequestTags);
  38.        if(MyFileReqStruct==NULL) return(NULL);
  39.        
  40.        ret = AslRequest(MyFileReqStruct,RequestTags);
  41.        if(!ret) {FreeAslRequest(MyFileReqStruct);return(NULL);}
  42.          
  43.        strcpy(file,MyFileReqStruct->rf_File);
  44.        strcpy(dir,MyFileReqStruct->rf_Dir);
  45.        strcpy(fullname,dir);
  46.        FreeAslRequest(MyFileReqStruct);
  47.        
  48.        if(fullname[strlen(fullname)-1] != ':')
  49.          strcat(fullname,"/");
  50.        strcat(fullname,file);
  51.        return(fullname);
  52.          
  53. }         
  54.