On 8/20/06, Prince Bhanwra <[EMAIL PROTECTED]> wrote:
getch() isn't in either C or C++ Standard, so that's wrong.
In addition, most implementations that /do/ provide a getch() function, have it returning an int so you can tell if it's returning an error. Otherwise you cannot tell the difference between (say) 255 and -1 being returned.
Any compiler worth it's salt should at least give a truncation warning (granted they aren't required to however)
This code will not output what you appear to think/indicate it will output.
heyfull form of "getch" is get a character. So it returns only one value and that a char value. By standards it cannot return int.
getch() isn't in either C or C++ Standard, so that's wrong.
In addition, most implementations that /do/ provide a getch() function, have it returning an int so you can tell if it's returning an error. Otherwise you cannot tell the difference between (say) 255 and -1 being returned.
value but some compilers don't give any error or warning and sometime it also works fine.
Any compiler worth it's salt should at least give a truncation warning (granted they aren't required to however)
But you should try not to go for it. You may opt for typecasting afterwards, if required results needs to be in int.SYNTAX:char test;test = getch();cout<<"test";
This code will not output what you appear to think/indicate it will output.
--
PJH
Into motorcycles? Need parts? Try www.gissit.com to contact lots of motorcycle breakers - free to use (UK based at the moment) __._,_.___
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
SPONSORED LINKS
| C and c++ | Computer programming languages | Java programming language |
| Basic programming language | Programming languages |
YAHOO! GROUPS LINKS
- Visit your group "c-prog" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
