1. Re: Getc()

Robert Craig wrote:

> Kevin Sieger writes:
>
> > In regards to the wait_key function the library says this...
>
> <stuff about get_key() in busy loop>
>
> > Now, if I were to use getc(0) (need to get input from a
> > modem or fossil driver) in a loop so that I may implement
> > real time in a game, should I have
> > to supply code in my game to detect
> > multitasking software like Desqview,
> > Windoze95, or OS/2?  This code would give up
> > a time slice to these taskers so
> > that other programs would not experience delays.
>
> In DOS32 wait_key() or getc(0) from the keyboard
> will "give up a time slice" to
> the operating system to run other programs, but I
> don't know of any other routines that will be so generous.
>
> If you use get_key() instead of wait_key(), the operating
> system will still do time slicing, but you will slow everything
> down with all the polling of the keyboard by get_key().
>
> In WIN32 you can call the C sleep() function to give up
> control for a period of time - in units of milliseconds.
>
> > Getc(0) would be the only logical choice here,
> > as gets() would not be sufficient for a real time game.
> > And remember, the input will be from ports,
> > not the keyboard.
>
> I don't understand. If your input is coming from
> ports, you would use one of Jacques Deschenes ports.e
> routines, not getc(0) or gets(0).
>
> Regards,
>      Rob Craig
>      Rapid Deployment Software

To tell you the truth, I had really not looked closely at ports.e - I
have it, just did not look at what functions/procedures were available
to grab strings, chars from the ports.  Basically I was going on
previous experience with Pascal, where the ports were assigned a "file
id", and you would Read or Readln thru the device that way.  Anyways,
you answered my question regarding getc(0).  Thank you very much.

Kevin Sieger

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu