home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_06 / 8n06102b < prev    next >
Text File  |  1990-03-11  |  1KB  |  52 lines

  1.  
  2.                           Figure 4
  3.  
  4. #include "empl.h"       /* Generated by a tool */
  5. #include "sml.h"        /* Library defines, etc. NOT SHOWN */
  6.  
  7. main(argc, argv)
  8.     int argc;
  9.     char *argv[];
  10. {
  11.  
  12.     int  sid,                    /* Screen identifier             */
  13.          status;
  14.     char *data[EMPL_MAX_FIELDS]; /* Pointers for accessing fields */
  15.  
  16.         init_sml(1);             /* Initialize the library */
  17.  
  18.         /*
  19.          * Open a screen
  20.         */
  21.         if ((sid=open_form(argv[1])) == SML_ERROR){
  22.             fprintf(stderr, "Error opening %s\n", argv[1]);
  23.             exit(1);
  24.         }
  25.  
  26.         /*
  27.          *  Display it.  The 0,0 is a row, columns offset on the current
  28.          *  window where the screen is displayed.
  29.         */
  30.         if(display_form(sid, 0, 0) == SML_ERROR){
  31.             fprintf(stderr, "Error displaying %s\n", argv[1]);
  32.             exit(1);
  33.         }
  34.  
  35.         /* Set up the custom edit function */
  36.         set_edit(sid, FO_EMPL_AGE, valid_age);
  37.  
  38.         /* Get the data                    */
  39.         do{
  40.             status = get_screen(sid, data);
  41.             /*
  42.              *  Do something with the data.  Write it, print it,
  43.              *  whatever...
  44.             */
  45.         }while(status != SML_EXIT);  /* Loop until the user is done...*/
  46.  
  47.         cleanup_sml();
  48. }
  49.  
  50.                           Figure 5
  51.  
  52.