Questions tagged [getch]

Questions relating to the use of the DOS getch() function

getch() is defined in <conio.h>, a header file used mostly by MS-DOS compilers to provide console input/output.

This function is provided on Microsoft platforms, but is not in the C standard library, nor in POSIX.

It is similar to the standard library getchar(), but disables terminal echo of the character that is returned.

299 questions
0
votes
1 answer

Non-Blocking Input in Java realized through JNI

I am in the pursuit of designing a command-shell using Java . One important feature which I had to immediately implement was "auto complete" , as facilitated by the command-shell when "tab" key is being pressed . For this , I reckoned I had to read…
bsv0099
  • 3
  • 2
0
votes
3 answers

stopping `scanf` when user enters "." DOT

I am messing around with the function below, I want to end input capture when user enters a DOT character. It seems that getche() is not doing what it is intentended to do: void Encode(FILE *fp) { char chWord[100]; char *chP; …
Dumbo
  • 13,555
  • 54
  • 184
  • 288
0
votes
2 answers

c++ alternative for getch() and clrscr()

I use code::blocks 10.05 for compiling C++. But I cannot use getch() It says unknown. When I #include it says unknown library. So what is the alternative to be able to use getch in C++?
Ajay
  • 61
  • 3
  • 13
0
votes
2 answers

How to make getch() accept taking an enter hit (\n)?

I made a touch typing console program in C++. It reads the text from a file and load it to the screen. User must enter the right letter in order for him to proceed to the next letter. My only Problem is with the '\n', so if I had something like this…
vexe
  • 5,433
  • 12
  • 52
  • 81
0
votes
2 answers

getch(); runtime error in c and codeblock

I use codeblocks IDE and gcc compiler. I tried to write the simple program billing system.We I use the getch(); for character input there will be no error during building the project but at run time there will be error and shows the error message…
user1255700
0
votes
1 answer

_getch not reading input into variable

I'm having trouble with the _getch() function, I want it so that the user does not need to hit ENTER when selecting things from the menu. However, when I try and use it, it either doesn't input the data into a variable, or it skips over the switch I…
Rocmalone
  • 35
  • 1
  • 1
  • 3
-1
votes
2 answers

How can I check my output without using Getch() in C

I just want to see my output without using any function e.g. Getch (). is it possible? Void main() { printf(" hello "); }
RangeX
  • 17
  • 5
-1
votes
1 answer

For some reason, when i use getch() my program crash, but if i use cin, then it works

I would like to know what knowledge I lack about inputs of arrays. I want to input one character and then automatically go to the next line of the code. Here is the code: char word[21]; for(int i = 0;i < 21; i++) { word[i] = getch(); …
-1
votes
3 answers

Is there any function in C to replace getch() for my given program as it a non-standard function?

I want and searching for a function or an alternative that could replace the non-standard getch() function of C language. I want help if any any function which can replace the getch() function from the code below or an appropriate alternative. I am…
-1
votes
2 answers

i dont understand why output is diffrent when print function value with variable

When I try print getk function direct with printf. It working fine. But when I store it to variable then always output is same. I am trying to get arrow keys as a input I am using gcc on code block windows 7. int getk() { int ch; ch =…
-1
votes
2 answers

Window for taking getch input not showing using ncursesw but works with ncurses

I need to use -lncursesw to print out unicode characters otherwise it wouldn't work however after compiling it with this, the window for user input shows up but when I type characters to it, it doesn't show but still able to type. I honestly don't…
Sirius
  • 27
  • 1
  • 12
-1
votes
1 answer

C++ getting keypad pad key press only if keyboard has been pressed

I'm trying to set this function up so that it waits for the user to press a key on the keypad and then returns the number that they pressed. This is what I've got but it seems to be allowing anything to be returned. int numpad(int min, int max) { …
-1
votes
2 answers

Use of getch function and gets and puts functions

Experts I've doubts in gets(),puts() and getch(). Why do we use gets() and puts() when we have scanf() and printf()? What is the use of getch(). Please explain this in simple language because I'm a beginner. THank you in advance. :)
SGG
  • 31
  • 1
  • 2
  • 8
-1
votes
1 answer

Handling Non-Specified & Non-Empty Getch() (C program)

I'm trying to handle when a user inputs something that is not specifically taken note of in the code. I'm using getch() and when a user inputs '1' there is a conditional that reacts to it; however, what I want to achieve is that if a user enters…
laroy
  • 163
  • 1
  • 1
  • 13
-1
votes
3 answers

What is the meaning of getch()==13

The source code is given bellow, What does the line of if(getch()==13) means.. int main() { int a[4],approx[4],b[4],i=0; int arr[4][6],sarr[4][6]; initialize(a); encoding(a,arr); while(i<5) { if(i==0) { …
NAT
  • 9
  • 3