2

I am looking for C++ code to get getch() and getche() functions for linux. I briefly looked at the code and I saw that they are using the new keyword just like an identifier.

Here is the link : What is Equivalent to getch() & getche() in Linux?

static struct termios old, new;
tcsetattr(0, TCSANOW, &new); /* use these new terminal i/o settings now */

Could anyone explain how it is possible? Is it valid C++ code? Thanks.

Community
  • 1
  • 1

1 Answers1

6

This is valid C code but it is not valid C++.

new is a keyword in C++ and cannot be used as an variable name.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483