By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,797 Members | 1,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,797 IT Pros & Developers. It's quick & easy.

_getch() implementation

P: n/a
Daz
Hi everyone.

I am trying to find out how _getch() works, as I need to use something
similar, but as well as looping for the first keyboard char pressed, I
also need to check to see if any application is still running within
the same loop also.

I have tried to find the code for _getch(), but I can only find:
_CRTIMP __checkReturn int __cdecl _getch_nolock(void);
in the conio.h header file. This is clearly the decleration, but I
can't find the implementation of it.

I would appreciate it if anyone could shed any light on the subject.

Finest regards.

Daz

Jun 26 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Daz

Daz wrote:
Hi everyone.

I am trying to find out how _getch() works, as I need to use something
similar, but as well as looping for the first keyboard char pressed, I
also need to check to see if any application is still running within
the same loop also.


should read:
I am trying to find out how _getch() works, as I need to use something
similar, but as well as looping for the first keyboard char pressed, I
also need to check to see if AN application is still running within
the same loop also.

Basically, if a particular application is closed manually, my program
should break the loop, and go onto the next stage of the process.

Jun 26 '06 #2

P: n/a
Implementation of _getch is defined here:
($VCIntallPart)\Crt\Src\getch.c
Probably you should implement message processing loop to hadle
keystrokes.

Jun 26 '06 #3

P: n/a
Daz wrote:
Hi everyone.

I am trying to find out how _getch() works, as I need to use something
similar, but as well as looping for the first keyboard char pressed, I
also need to check to see if any application is still running within
the same loop also.

I have tried to find the code for _getch(), but I can only find:
_CRTIMP __checkReturn int __cdecl _getch_nolock(void);
in the conio.h header file. This is clearly the decleration, but I
can't find the implementation of it.

I would appreciate it if anyone could shed any light on the subject.

Try a windows group, it isn't standard C++.

--
Ian Collins.
Jun 26 '06 #4

P: n/a
Daz

anali...@yandex.ru wrote:
Implementation of _getch is defined here:
($VCIntallPart)\Crt\Src\getch.c
Probably you should implement message processing loop to hadle
keystrokes.


Excellent! I have found it, and now I just have to understand it. :)

Thanks for your help.

Jun 26 '06 #5

P: n/a
Daz

Ian Collins wrote:
Daz wrote:
Hi everyone.

I am trying to find out how _getch() works, as I need to use something
similar, but as well as looping for the first keyboard char pressed, I
also need to check to see if any application is still running within
the same loop also.

I have tried to find the code for _getch(), but I can only find:
_CRTIMP __checkReturn int __cdecl _getch_nolock(void);
in the conio.h header file. This is clearly the decleration, but I
can't find the implementation of it.

I would appreciate it if anyone could shed any light on the subject.

Try a windows group, it isn't standard C++.

--
Ian Collins.


Thanks Ian! This is quite frustrating for me, as I can never seem to
tell if something is platform specific, or general C++. How do I tell?

Thanks.

Jun 26 '06 #6

P: n/a
> Excellent! I have found it, and now I just have to understand it. :)

It depends on WinApi console functions. If you have non-console
applications then message processing loop will be better solution, you
just need to implement WM_CHAR message handling.

Jun 26 '06 #7

P: n/a
"Daz" wrote:
This is quite frustrating for me, as I can never seem to
tell if something is platform specific, or general C++. How do I tell?


Look at this site, if it is listed here it is standard, otherwise it is
platfrom specific.

http://www.dinkum.com/manuals/default.aspx?Page=

Be sure to only use the C library information via the C++ link, otherwise
you can blunder into C99 stuff.
Jun 26 '06 #8

P: n/a
Daz

osmium wrote:
Look at this site, if it is listed here it is standard, otherwise it is
platfrom specific.

http://www.dinkum.com/manuals/default.aspx?Page=

Be sure to only use the C library information via the C++ link, otherwise
you can blunder into C99 stuff.


Thanks osmium! :) The page has been bookmarked accordingly.

Jun 26 '06 #9

P: n/a
Daz wrote:
Ian Collins wrote:
Daz wrote:
Hi everyone.

I am trying to find out how _getch() works, as I need to use something
similar, but as well as looping for the first keyboard char pressed, I
also need to check to see if any application is still running within
the same loop also.

I have tried to find the code for _getch(), but I can only find:
_CRTIMP __checkReturn int __cdecl _getch_nolock(void);
in the conio.h header file. This is clearly the decleration, but I
can't find the implementation of it.

I would appreciate it if anyone could shed any light on the subject.

Try a windows group, it isn't standard C++.

--
Ian Collins.


Thanks Ian! This is quite frustrating for me, as I can never seem to
tell if something is platform specific, or general C++. How do I tell?


1. If it uses CamelCase, it's probably WinAPI or some other platform
specific, but definitely not part of the Standard.
2. If it has a leading underscore, it's implementation specific.

Jun 26 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.