Newer
Older
Microsoft / lookey / LOOKEY.C
@tundra tundra on 24 May 2012 556 bytes Initial revision
/*  LOOKEY.C - 	This utility gets a keystroke from STDIN and displays both
				the decimal and hexadecimal equivalent values on STDOUT.

	Last Modified: 01/01/85 - Copyright (c) 1985 By T.A. Daneliuk		*/


#include	<stdio.h>

main()

{

char	c;
int		i;
static char	array[3]={"\0\0\0"};

while ((c=bdos(7,0,0)) != 0x1A)			/* Cntrl-Z Terminates */
	
	{		

	i = (int) c;						/* Cast to integer value */
	tohex2(i,array);					/* Get 2 digit hex equivalent */
	printf("%c	Key Value Is: %d Decimal	%s Hexadecimal\n",c,i,array);
	
	}

}