home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / thnker.zip / THNKTEST.C next >
Text File  |  1994-04-30  |  1KB  |  49 lines

  1. #define         INCL_BASE
  2. #define         INCL_PM
  3. #include        <os2.h>
  4. #include        <stdio.h>
  5. #include        <stdlib.h>
  6. #include        <string.h>
  7. #include    <thunker.h>
  8. static  char str[]= "This is a dummy string\0";
  9. static  char string[]= "This is a test of the VioWrtTTY function\r\n\0";
  10.  
  11.  
  12. char  getch(void);
  13. void    main()
  14. {
  15.         char    a;
  16.         long    i;
  17.         char    varstring[80] ;
  18.         BYTE    bCell[2];
  19.         ULONG    usAttribute;
  20.     KBDINFO Kbdinfo;
  21.         bCell[0] = 0x20;
  22.         bCell[1] = 0x22;
  23.     DosQFileMode("THNKTEST.C" ,&usAttribute, 0) ;
  24.     i = DosSetFileMode("THNKTEST.C",usAttribute, 0) ;
  25.     printf("The file set mode status was %li \n\r",i) ; 
  26.         Kbdinfo.cb = sizeof (Kbdinfo) ;
  27.         VioSetCurPos(5,5,0);
  28.         VioScrollUp(0,0,0xffff,0xffff,0xffff,bCell,0);
  29.         KbdGetStatus(&Kbdinfo,0);
  30.         if (Kbdinfo.fsMask & KEYBOARD_ECHO_ON)
  31.                 VioWrtTTY("Echo is on\n\r", 12, 0) ;
  32.         else
  33.                 VioWrtTTY("Echo is off\n\r", 13, 0) ; 
  34.         a = getch() ;
  35.         for (i = 0 ;i < 5; i++)
  36.                 printf("%c\n",a) ;
  37.         i = strlen(string);
  38.         VioWrtTTY(string, i, 0) ;
  39.         printf("%i\n",strlen(string));
  40.         sprintf(varstring,"The length of string one is %i\r\n",strlen(string));
  41.         VioWrtTTY(varstring,strlen(varstring),0);
  42. }
  43.  
  44. char  getch(void)
  45. {
  46.         KBDKEYINFO Kbci ;
  47.         KbdCharIn( &Kbci,IO_WAIT,0);
  48.         return Kbci.chChar;
  49. }