Skip to content

Commit ba7be1a

Browse files
committed
Avoid collision with existing getch() function on win
1 parent 456741c commit ba7be1a

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

doc/examples/external_fts_through_rtde.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ keyboard input commands.
6363
Input key handling
6464
------------------
6565

66-
For handling the keyboard input, define a ``getch()`` function that reads a single character from
66+
For handling the keyboard input, define a ``getChar()`` function that reads a single character from
6767
the terminal without waiting for a newline character. This has to be done differently on Windows
6868
and Linux (and other unix-like systems), therefore the code is split using preprocessor directives.
6969

@@ -72,7 +72,7 @@ and Linux (and other unix-like systems), therefore the code is split using prepr
7272
:caption: external_fts_through_rtde/freedrive_example.cpp
7373
:linenos:
7474
:lineno-match:
75-
:start-at: // Platform-specific implementation of getch()
75+
:start-at: // Platform-specific implementation of getChar()
7676
:end-at: #endif
7777

7878
Setting the external force-torque values

examples/external_fts_through_rtde.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@
3434
#include "ur_client_library/example_robot_wrapper.h"
3535
#include "ur_client_library/types.h"
3636

37-
// Platform-specific implementation of getch()
37+
// Platform-specific implementation of getChar()
3838
#if defined(_WIN32) || defined(_WIN64)
3939
# include <conio.h>
40-
char getch()
40+
char getChar()
4141
{
4242
return _getch(); // Windows-specific
4343
}
4444
#else
4545
# include <termios.h>
4646
# include <unistd.h>
47-
char getch()
47+
char getChar()
4848
{
4949
termios oldt, newt;
5050
char ch;
@@ -77,7 +77,7 @@ void ftInputTui()
7777
while (g_RUNNING)
7878
{
7979
std::cout << instructions << std::endl;
80-
char ch = getch();
80+
char ch = getChar();
8181

8282
std::cout << "<'" << ch << "' pressed>" << std::endl;
8383

0 commit comments

Comments
 (0)