GetChar loop

D

Daz

Hi everyone.

I have already posted (off topic) about the _getch() method, which is
platform specific. However, I have had a bit more of a think about what
I would like to do, and _getch() is not what I am looking for.

I need to make a loop that checks for 2 things. Firstly, whether or not
a key has been pressed, and if so what one. Secondly, I need to check
whether or no a particular application is still open or not. If the app
is open, as soon as it's closed, my program should stop waiting for a
keypress, and move onto the next function.

I know what this needs to go into a loop, and I know what I need to do
to check if an application is running, but I don't have a clue as to
where to start about checking for keyboard input at the same time.

I would really appreciate it if anyone could point me towards the
appropriate tools/functions that I might need to use. Ideally, I could
do with something simple to implement, but I am unsure if this really
can be that simple. My program is just a plain old console program, so
I can't use any TWL/MFC headers.

Thanks in advance.

Daz
 
H

Howard

Daz said:
Hi everyone.

I have already posted (off topic) about the _getch() method, which is
platform specific. However, I have had a bit more of a think about what
I would like to do, and _getch() is not what I am looking for.

I need to make a loop that checks for 2 things. Firstly, whether or not
a key has been pressed, and if so what one. Secondly, I need to check
whether or no a particular application is still open or not. If the app
is open, as soon as it's closed, my program should stop waiting for a
keypress, and move onto the next function.

I know what this needs to go into a loop, and I know what I need to do
to check if an application is running, but I don't have a clue as to
where to start about checking for keyboard input at the same time.

I would really appreciate it if anyone could point me towards the
appropriate tools/functions that I might need to use. Ideally, I could
do with something simple to implement, but I am unsure if this really
can be that simple. My program is just a plain old console program, so
I can't use any TWL/MFC headers.

Thanks in advance.

Daz

Hi Daz,

to accomplish either of those things, you'll need platform-specific
tools/libraries. Check on a Microsoft newsgroup (hosted on the
msnews.microsoft.com or news.microsoft.com servers).

-Howard
 
D

Daz

Howard said:
Hi Daz,

to accomplish either of those things, you'll need platform-specific
tools/libraries. Check on a Microsoft newsgroup (hosted on the
msnews.microsoft.com or news.microsoft.com servers).

-Howard

Pants! I effectively asked the same question in a different fashion...
I dread to think how hard it's going to be when I start writing
portable code and non-platform-specific software...

Thanks for your input Howard! It's very much appreciated as always. :)

(Apologies to anyone currently pulling their hair out due to idiots,
such as myself, posting 'off-topic' and not realizing).
 
S

Stuart Moore

Pants! I effectively asked the same question in a different fashion...
I dread to think how hard it's going to be when I start writing
portable code and non-platform-specific software...

Thanks for your input Howard! It's very much appreciated as always. :)

(Apologies to anyone currently pulling their hair out due to idiots,
such as myself, posting 'off-topic' and not realizing).

If you want portable code that does this kind of thing, you'll probably
need a cross platform library - wxWidgets is one I'm aware of.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top