home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_USER / 1990 / USERAU90.MSA / LISTINGS.ARC / FSELECT.C < prev    next >
C/C++ Source or Header  |  1990-06-25  |  1KB  |  50 lines

  1. /* C  file selector */
  2. /* Digital Wisdom C */
  3.  
  4. #include <string.h>
  5.  
  6. short    contrl[12],
  7.         intin[128],
  8.         intout[128],
  9.         ptsin[128],
  10.         ptsout[128],
  11.         work_in[12] = { 1,1,1,1,1,1,1,1,1,1,2 },
  12.         work_out[57],
  13.         handle;                        /* vdi handle */
  14.  
  15. char path[80],name[20];
  16.  
  17. main()
  18. {
  19.     short i;
  20.     appl_init();
  21.     handle = graf_handle(&i,&i,&i,&i);    /* i is dummy variable */
  22.     v_opnvwk(work_in,&handle,work_out);
  23.     if (get_file()) {
  24.         v_clrwk(handle);                /* clear the screen
  25.         vst_color(handle,1)                /* black ink */
  26.         v_gtext(handle,16,16,path);        /* print filename */
  27.     }
  28.     evnt_keybd();
  29.     v_clsvwk(handle);
  30.     appl_exit();
  31. }
  32.  
  33. get_file()
  34. {
  35.     short button,len;
  36.     strcpy(path,"A:\\*.*");            /* default path */
  37.     path[0] += Dgetdrv();            /* set to current drive */
  38.     strcpy(name,"");                /* null filename */
  39.     fsel_input(path,name,&button);    /* do file selector */
  40.     graf_mouse(0,0);                /* change mouse to pointer */
  41.     if ( name[0]=='\0' || button==0 )
  42.         return(0);                    /* no filename or Cancel pressed */
  43.     len = strlen(path);
  44.     while ( path[len-1]!='\\' )        /* knock out *.* from path */
  45.         --len;
  46.     path[len] = '\0';                /* mark end of path */
  47.     strcat(path,name);                /* concatenate strings */
  48.     return(1);
  49. }
  50.