Computing.Net > Forums > Disk Operating System > DOS programing C

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

DOS programing C

Reply to Message Icon

Name: Daniel
Date: April 1, 2002 at 13:10:04 Pacific
Comment:

I am new to C and i am working on a simple DOS program.

Can anybody tell help me with a simple C function call that will
return a character if one has been entered from the keyboard or a NULL
if one has not, without stopping program execution and waiting for a
CR as happens with getch ().

If one is not avaible can somebody help me with some simple assembler
code that would do this?

Thanks in advance, Daniel.



Sponsored Link
Ads by Google

Response Number 1
Name: Daniel
Date: April 1, 2002 at 13:14:14 Pacific
Reply:

Dam it

SORRY wrong Forum

sosososo SORRY



0

Response Number 2
Name: Uv
Date: April 4, 2002 at 11:08:40 Pacific
Reply:

The dos.h include has a function called int86x(...) This function will call a ROM BIOS real mode interrupt according to the arguments.
Try out intno = 0x16 and the inregs.ah = 01

I am not absolutely certain of the output if there is no key in the keyboard buffer. But the function returns immediately. In reality, the zero flag of the processor is set if there is no key pressed. If there is a key waiting, then zero flag is cleared and ax = key code (scan+ascii).

(This is a bit too technical, but I hope it helped...)


0

Response Number 3
Name: MR Loadlin
Date: April 26, 2002 at 15:31:46 Pacific
Reply:

That Is Easy
Use the kbhit() function this way

if(!kbhit())
//do you work here the user didnt press
// any key
else
{
the user has pressed a key
find that key with getch()
and process it

!! remeber getch() is going to search
in the keyboard buffer so it is going
to find the pressed key
!!! Hope I have solved you problem
!! and sorry for bad english


0

Response Number 4
Name: majid
Date: May 16, 2002 at 03:48:36 Pacific
Reply:

subject is hardware programing.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Spark Notebook NDO2000 Networking - DESP...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: DOS programing C

Capturing output from a dos program www.computing.net/answers/dos/capturing-output-from-a-dos-program/8845.html

Copying DOS program to WIN98 www.computing.net/answers/dos/copying-dos-program-to-win98/3805.html

shutting down DOS program in Windows www.computing.net/answers/dos/shutting-down-dos-program-in-windows/10204.html