home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / pcmag / vol7n14.arc / TRYQFN.C < prev   
Text File  |  1988-04-25  |  972b  |  38 lines

  1. /*
  2.         TRYQFN.C    Demonstration of use of QFN.C
  3.                     module to qualify filenames.
  4.  
  5.         Ray Duncan, April 1988
  6. */
  7.  
  8. #include <stdio.h>
  9.  
  10. extern char *qfn(char *);
  11.  
  12. main(int argc, char *argv[])
  13. {
  14.     char buffer[80];                /* buffer for user input */
  15.  
  16.     char *p;                        /* receives ptr from qfn */
  17.  
  18.     while(1)                        /* do until empty line */
  19.     {
  20.                                     /* prompt user for filename */
  21.         printf("\nEnter filename:        ");
  22.  
  23.         gets(buffer);               /* read in filename */
  24.  
  25.         if(buffer[0] == 0) break;   /* exit if no entry */
  26.  
  27.         p = qfn(buffer);            /* else qualify filename */
  28.  
  29.         if(p != NULL)               /* display filename or
  30.                                        error message */
  31.  
  32.             printf("\nThe full pathname is:  %s\n",p);
  33.  
  34.         else printf("\nBad filename!\n");
  35.   } 
  36.  
  37. }
  38.