'Passing End of Transmission (Ctrl + D) character in Eclipse CDT console
I have a C++ application, to which i need to send an End of Transmission signal.
I can do a Ctrl+D on the console, but when I try that within Eclipse, it doesn't work.
I am using Eclipse Galileo with CDT.
Solution 1:[1]
I just found a solution to this problem:
When you finish entering your inputs on console, click on another window (editor, Project Explorer, etc.), then click back on console. Hitting Ctrl + Z will work now.
Solution 2:[2]
One way you might consider sending ctrl+d to the console is by doing a little BASH injection in your program arguments. appending something like "& sleep 10 && echo -e '\x04\c' > /dev/stdin" for example will wait 10 seconds before sending the ctrl-D command. though you could easily modify it for some other non-timebased condition as well. In addition, you could open /dev/stdin from your C++ program as a file, then write the value 0x04 into it then flush to achieve the same effect from your program.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Matt |
| Solution 2 | S E |
