Re: [Dev-C++] differnece between system pause and cin.get()
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Lucas K. T. <lk...@bo...> - 2003-02-18 01:01:21
|
Although this is probably pretty useless to you... =20 >Thanks for the response. >Is there a way of chekking if there`s annything left in the >cin = stream.=20 >Or to empty it for that matter before using it as a tool for >keeping = dos boxes open :-) Well to empty the keyboard buffer, you'd have to go through memory = access and move the value that is within: 40h:[1Ch] to 40h:[1Ah], 'cause = you see, the keyb buffer is circular and 32-bytes long, and 40h:[1Ah] = points to it's head, while 40h:[1Ch] points to it's tail, so basically, = by assigning the same value to them, the buffer would get cleared, = sample code (although I'm not sure this would work in a Win console = program, it'd work on a DOS program): word tail; tail =3D peek(0x40, 0x1C); poke(0x40, 0x1A, tail); Or perhaps you could try: poke(0x40, 0x1A, peek(0x40, 0x1C)); directly... I'm have tested neithe,r but they should work just fine... Unecessary information, thoguh... but it's always nice ot learn new = things... hehee =3D) lkt153 |