[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[Cdt-launch-inbox] [Bug 235365] New: eclipse console does not satisfy _kbhit()
|
https://bugs.eclipse.org/bugs/show_bug.cgi?id=235365
Product/Component: CDT / cdt-launch
Summary: eclipse console does not satisfy _kbhit()
Product: CDT
Version: 4.0.3
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P3
Component: cdt-launch
AssignedTo: cdt-launch-inbox@xxxxxxxxxxx
ReportedBy: olivier.cailloux@xxxxxxxxx
Build ID: M20080221-1800
Steps To Reproduce:
Consider the following C program:
---
#include <conio.h>
#include <stdio.h>
int main(int argc, char *argv[ ], char *envp[ ]) {
char input[20];
gets (input);
printf(input); fflush(stdout);
while (1) {
if (_kbhit()) {
printf("kb hit!"); fflush(stdout);
_getch();
}
}
}
---
_kbhit() "checks the console for a recent keystroke. If the function returns a
nonzero value, a keystroke is waiting in the buffer."
(http://msdn.microsoft.com/en-us/library/58w7c94c(VS.71).aspx).
Compile in a CDT project, and run within eclipe, with, in Run settings,
"common" tab, "Allocate console" checked (so that you can use the console to
input text to stdin).
Run it, and input some short text line (say, "hello"), observe that the program
echoes your input. Then type some text. Observe that the program does not see
_kbhit() as true.
More information:
Running the same program in the windows console makes it work like a charm: the
program echoes your first sentence then repetitively says "kb hit!" each time
you press one more key.
This bug may be somehow related to bug number 173732
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=173732), although it's
different. This one complains about "input from console" while the other one
complains about "output to the console".
--
Configure bugmail: https://bugs.eclipse.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.