473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

what is the difference between getch() & getche()

help me out with the subject

Mar 5 '06 #1
28 9827
In article <11**********************@i40g2000cwc.googlegroups .com>,
srikanth <ad********@gmail.com> wrote:
help me out with the subject


I've never heard of getche(). Did you perhaps mean getchar() ?

--
Is there any thing whereof it may be said, See, this is new? It hath
been already of old time, which was before us. -- Ecclesiastes
Mar 5 '06 #2
i am right to what i meant sir it is getche ( )and not getchar( )

Mar 5 '06 #3
srikanth wrote:
i am right to what i meant sir it is getche ( )and not getchar( )


neither getch or getche are standard functions.
You need to explain where you discovered those function, or probably
ask in an OS dependant newsgroup.
Mar 5 '06 #4
srikanth wrote:
i am right to what i meant sir it is getche ( )and not getchar( )


1. Quote what a nd who you're replying to.
2. Be polite when asking for help.
3. One is standard C, the other one isn't.
4. Go figure.

--
BR, Vladimir

Don't be overly suspicious where it's not warranted.

Mar 5 '06 #5
Nils O. Selåsdal
neither getch or getche are standard functions
my reply :getch( ) and getche( ) are pre defined functions in C LANG.
:they are under the headerfile <conio.h>

Mar 5 '06 #6
srikanth wrote:
Nils O. Selåsdal
neither getch or getche are standard functions
my reply :getch( ) and getche( ) are pre defined functions in C LANG.
:they are under the headerfile <conio.h>


My reply: you are a troll. Goodbye...

--
BR, Vladimir

I prefer rogues to imbeciles because they sometimes take a rest.
-- Alexandre Dumas the Younger

Mar 5 '06 #7
srikanth wrote:
help me out with the subject
Repeated for those who don't bother with subject headers, knowing that
they are meaningless and are not the place to put important parts of posts: what is the difference between getch() & getche()


From the point of view of C, none. They are undefined identifiers
denoting some function or the other. Neither is part of C. Similarly
named functions (or possibly macros) in C are fgetc(), getc(), and
getchar().
Mar 5 '06 #8
srikanth írta:
help me out with the subject

getch(): reads a char from the keyboard. It doesn't echoes it to the screen.
getche(): reads a char from the keyboard and echoes it to screen.
Mar 5 '06 #9
srikanth wrote:
Nils O. Selåsdal
neither getch or getche are standard functions
my reply :getch( ) and getche( ) are pre defined functions in C LANG.
:they are under the headerfile <conio.h>

Which isn't a standard header, you'll have to ask in a platform specific NG.

--
Ian Collins.
Mar 5 '06 #10
On 2006-03-05, srikanth <ad********@gmail.com> wrote:
Subject: Re: what is the difference between getch() & getche()


Neither are in the standard.

[OT]getche() echoes, getch() does not.[/OT]
Mar 5 '06 #11
srikanth wrote
(in article
<11*********************@t39g2000cwt.googlegroups. com>):
i am right to what i meant sir it is getche ( )and not getchar( )


No you are not, at least not in terms of standard C. I think
you are referring to an abomination provided by Microsoft. If
so, the incredibly helpful (ahem) MSDN should tell you enough to
make you dangerous.

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw

Mar 5 '06 #12
srikanth wrote
(in article
<11**********************@u72g2000cwu.googlegroups .com>):
Nils O. Selåsdal
neither getch or getche are standard functions
my reply :getch( ) and getche( ) are pre defined functions in C LANG.
No, they are not.
:they are under the headerfile <conio.h>


That is a "predefined" and "nonstandard" header. Just because
your chosen compiler provides additional interfaces does NOT
make it part of standard C.


--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw

Mar 5 '06 #13
B. P. TBC wrote
(in article <44******@andromeda.datanet.hu>):
srikanth írta:
help me out with the subject

getch(): reads a char from the keyboard. It doesn't echoes it to the screen.
getche(): reads a char from the keyboard and echoes it to screen.


Wrong. My version of getch(), which I am free to implement as I
see fit since it is not in standard C, calculates the sqrt of 4
over and over again, just because I find that fun to do.
getche() reboots my computer, but only after asking whether or
not I want to wipe out the partition table first.

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw

Mar 5 '06 #14
B. P. TBC wrote:
srikanth írta:
help me out with the subject

getch(): reads a char from the keyboard. It doesn't echoes it to the
screen.
getche(): reads a char from the keyboard and echoes it to screen.


Who says so? Where in the standard is this behavior specified? For
that matter, where in the standard are these "keyboard" and "screen"
discussed?[1]

[1] <ot> Having just checked my collection of standards other than for
C, I see that the Fortran 77 (but not Fortran 66) standard mentions a
"keyboard" in passing once, but never a "screen". </ot>
Mar 5 '06 #15
On Sun, 5 Mar 2006 20:05:43 +0000 (UTC), in comp.lang.c ,
ro******@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
In article <11**********************@i40g2000cwc.googlegroups .com>,
srikanth <ad********@gmail.com> wrote:
help me out with the subject


I've never heard of getche(). Did you perhaps mean getchar() ?


Its some ancient borland extension to C.

To the OP: read your compiler documentation. Neither function is a
standard C function and we can't help you here.
Mark McIntyre
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Mar 5 '06 #16

"srikanth" <ad********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
help me out with the subject


They are DOS console IO functions. getche() displays the character on the
screen. getch() doesn't.
A complete Borland C++ reference is available here:
http://poli.cs.vsb.cz/c/help/index
i.e., to see getche() click "C++ Language", click "conio.h", click "getche".
Under "Portability", you'll see that the function is DOS only.
Rod Pemberton
Mar 6 '06 #17
"srikanth" <ad********@gmail.com> writes:
Nils O. Selåsdal
neither getch or getche are standard functions
my reply :getch( ) and getche( ) are pre defined functions in C LANG.
:they are under the headerfile <conio.h>


1. You are mistaken.

2. Read <http://cfaj.freeshell.org/google/>.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 6 '06 #18
"B. P. TBC" wrote:
srikanth írta:
help me out with the subject

getch(): reads a char from the keyboard. It doesn't echoes it to
the screen.
getche(): reads a char from the keyboard and echoes it to screen.


You are aiding and abetting a troll. Because of the misinformation
in your reply (neither function is mentioned in the standard) I
offer the following implementations:

#define choke continue

/* get and choke */
int getch(void) {
volatile int ch;
ch = getchar();
while (ch) choke;
return ch;
}

/* get and choke on e */
int getche(void)
volatile int ch;
ch = getchar();
while ('e' == ch) choke;
return ch;
}

Just compile and use these and you should be all set, and standards
compliant to boot.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Mar 6 '06 #19
On Sun, 05 Mar 2006 22:52:39 +0000, Mark McIntyre
<ma**********@spamcop.net> wrote:
I've never heard of getche(). Did you perhaps mean getchar() ?


Its some ancient borland extension to C.


<OT> It predates Borland, and is "etch() with echo."

Now, you may ask, what is etch()? It's off-topic.
</OT>

--
Al Balmer
Sun City, AZ
Mar 6 '06 #20
On Mon, 06 Mar 2006 08:53:14 -0700, Al Balmer <al******@att.net>
wrote:
On Sun, 05 Mar 2006 22:52:39 +0000, Mark McIntyre
<ma**********@spamcop.net> wrote:
I've never heard of getche(). Did you perhaps mean getchar() ?


Its some ancient borland extension to C.


<OT> It predates Borland, and is "getch() with echo."

Now, you may ask, what is getch()? It's off-topic.
</OT>


Repost. Damned spell checker.

--
Al Balmer
Sun City, AZ
Mar 6 '06 #21
On Mon, 06 Mar 2006 08:53:56 -0700, in comp.lang.c , Al Balmer
<al******@att.net> wrote:
On Mon, 06 Mar 2006 08:53:14 -0700, Al Balmer <al******@att.net>
wrote:
On Sun, 05 Mar 2006 22:52:39 +0000, Mark McIntyre
<ma**********@spamcop.net> wrote:
I've never heard of getche(). Did you perhaps mean getchar() ?

Its some ancient borland extension to C.


<OT> It predates Borland, and is "getch() with echo."

Now, you may ask, what is getch()? It's off-topic.
</OT>


Repost. Damned spell checker.


nono, "etch" was much more interesting. I mean, which programmer ever
cornered someone at a party and offered chance to see their getchings?
Mark McIntyre
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Mar 6 '06 #22
"srikanth" <ad********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
help me out with the subject


Being as no one else in this group is willing to help you,
I've decided to take a stab at it myself.

Your question:
what is the difference between getch() & getche()

The answer you've been patiently waiting for:
The second function has an 'e' at the end of the name
and the first one does not.

HTH,
Mark
Mar 6 '06 #23
B. P. TBC said:
srikanth írta:
help me out with the subject

getch(): reads a char from the keyboard. It doesn't echoes it to the
screen. getche(): reads a char from the keyboard and echoes it to screen.


In Zog C, getch() GETs a Cluster from the Hard disk - or at least it did
back in 1999.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Mar 6 '06 #24
Richard Heathfield <in*****@invalid.invalid> writes:
B. P. TBC said:

In Zog C, getch() GETs a Cluster from the Hard disk - or at least it did
back in 1999.


And getche() summons a Cuban revolutionary?
--
"Your correction is 100% correct and 0% helpful. Well done!"
--Richard Heathfield
Mar 6 '06 #25
Ben Pfaff said the following on 3/6/2006 5:24 PM:
Richard Heathfield <in*****@invalid.invalid> writes:
B. P. TBC said:

In Zog C, getch() GETs a Cluster from the Hard disk - or at least it did
back in 1999.


And getche() summons a Cuban revolutionary?


That would be Che Stadium, right?
--

---- Len Philpot -------- le*@philpot.org
------- ><> ------------- http://members.cox.net/lenphilpot/
Mar 7 '06 #26
Ben Pfaff wrote:
Richard Heathfield <in*****@invalid.invalid> writes:

B. P. TBC said:

In Zog C, getch() GETs a Cluster from the Hard disk - or at least it did
back in 1999.

And getche() summons a Cuban revolutionary?


Very good Ben.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Mar 7 '06 #27
Mark B wrote:
"srikanth" <ad********@gmail.com> wrote in message
help me out with the subject


Being as no one else in this group is willing to help you,
I've decided to take a stab at it myself.


What do you mean? I posted a reply with an implementation of both
getch and getche in standard C about 30 hours ago.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Mar 7 '06 #28
"CBFalconer" writes:
Mark B wrote:
"srikanth" <ad********@gmail.com> wrote in message
help me out with the subject


Being as no one else in this group is willing to help you,
I've decided to take a stab at it myself.


What do you mean? I posted a reply with an implementation of both
getch and getche in standard C about 30 hours ago.


It is my opinion that telling a joke twice doesn't make it any funnier. If
they didn't appreciate it on the first telling, they are unlikely to enjoy
it any more the second time they hear it.
Mar 7 '06 #29

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: VivekR | last post by:
Hi, Consider the program snippet below main { .... printf("Enter Choice: "); int choice = getche();
9
by: James McLaughlin | last post by:
Hi, Does anyone know if it's possible to write either a getch() (preferably Borland-style) or getche() function in C without it being platform-dependent or otherwise non-standard? If not, can...
16
by: supriya12345 | last post by:
hi everybody. Could u plz explain what's the difference between getchar(),getche() and getch() functions. Also explain the concept of buffer .
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.