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
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?
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
Summary: There are 3 ways to use text output from a DOS program. 1. Use the right arrow,>,to send the text to a file. For example to save the contents of a directory type, dir>dir.txt. This redirect...
Summary: Have friend w/simple DOS program I moved to his WIN3.11 computer years ago. He now has newer computer & WIN98 & wants program moved to it. I, too, have WIN98 but am rusted on what I did back then, s...
Summary: Here's a strange question... Is there a way to shut down dos programs in Win98SE that require contC, without disengaging the properties/misc/warn tab? I would like to write a bat file that shuts dow...