c - getch is deprecated -
Some time ago I did some C and C ++ in college, but I did not get much attention at C ++. Now I want to pay some attention to C ++, but when I am using the getch () function, I get a warning from below.
WARNING C4996: 'getch': POSIX name has been disliked for this item. Instead, use the ISO C ++ Confirm Name: _getch. See online help for details.
Now, I am using VS2005 Express, and I do not know what to do about this warning, after I getch () Need to use printf () an error message or something else that requires a significant hit
. Can you help me?
Microsoft decided to mark the name without the name, because these names are reserved for the programmer Select are Typical extensions for implementations should use names that begin with underscores in the global namespace if they want to follow the C or C ++ standard - or they should mark themselves as a composite standard compliant environment, such as That POSIX / ANSI / ISO C, where the function then matches one of those parameters.
Read also, for an explanation by PJ Plager, which knows the stuff very well, of course.
If you are only interested in waiting for some keys typed by the user, there is no reason to actually use getchar . But sometimes it is more practical and convenient for the user to use _getch and friends. However, they are not specified by C or C ++ standards and thus will limit your program's portability. Keep this in mind.
Comments
Post a Comment