home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / COMPILER / SAMPLE05 / MAIN05.C < prev    next >
Text File  |  1995-04-20  |  3KB  |  81 lines

  1. #pragma strings( readonly )
  2. /******************************************************************************/
  3. /*                                                                            */
  4. /* MAIN05.C                                                                   */
  5. /*                                                                            */
  6. /* COPYRIGHT:                                                                 */
  7. /* ----------                                                                 */
  8. /* Copyright (C) International Business Machines Corp., 1991, 1993.           */
  9. /*                                                                            */
  10. /* DISCLAIMER OF WARRANTIES:                                                  */
  11. /* -------------------------                                                  */
  12. /* The following [enclosed] code is sample code created by IBM                */
  13. /* Corporation.  This sample code is not part of any standard IBM product     */
  14. /* and is provided to you solely for the purpose of assisting you in the      */
  15. /* development of your applications.  The code is provided "AS IS",           */
  16. /* without warranty of any kind.  IBM shall not be liable for any damages     */
  17. /* arising out of your use of the sample code, even if they have been         */
  18. /* advised of the possibility of such damages.                                */
  19. /*                                                                            */
  20. /* This example asks the user which entrypoints to invoke and will invoke     */
  21. /* one of the following:                                                      */
  22. /*                                                                            */
  23. /* 1 -  DLLINCREMENT- Accepts a count from its client and adds                */
  24. /*                    this value to the process and system totals             */
  25. /*                                                                            */
  26. /* 2 -  DLLSTATS    - Dumps process and system totals on behalf               */
  27. /*                    of its client                                           */
  28. /*                                                                            */
  29. /******************************************************************************/
  30.  
  31. #include <stdio.h>
  32. #include "sample05.h"
  33.  
  34. int main( void )
  35.    {
  36.    int  loop_cont = 1;
  37.    int  rc;
  38.    char inchar;
  39.  
  40.    while ( loop_cont )
  41.       {
  42.       printf( "Enter 1 - to Increment\n" );
  43.       printf( "Enter 2 - for Statistics\n" );
  44.       printf( "Enter x to terminate\n" );
  45.  
  46.       /* Get a character from stdin.                                          */
  47.  
  48.       while ( ( inchar = getchar() ) < 0x20 )
  49.          ;
  50.  
  51.       /* Process the character entered.                                       */
  52.  
  53.       switch ( inchar )
  54.          {
  55.          case '1':
  56.             if ( ( rc = DLLINCREMENT( 17 ) ) != 0 )
  57.                loop_cont = 0;
  58.             break;
  59.  
  60.          case '2':
  61.             if ( ( rc = DLLSTATS() ) != 0 )
  62.                loop_cont = 0;
  63.             break;
  64.  
  65.          case 'x':
  66.             loop_cont = 0;
  67.             break;
  68.  
  69.          default:
  70.             printf( "Invalid Option.. retry\n" );
  71.             break;
  72.          }
  73.  
  74.       /* Read the carriage return character and throw it away.                */
  75.  
  76.       getchar();
  77.       }
  78.  
  79.    return 0;
  80.    }
  81.