Questions tagged [conio]

A non-standard C library that enables users to move the cursor on Terminals and place characters at certain locations.

The conio library is a C library mostly provided by MS-DOS compilers to provide console input/output beyond what is provided by the C standard library.

Conio does not form part of the C standard library or ISO C, nor is it defined by POSIX. This means that the functions in the conio library vary somewhat between compilers.

111 questions
1
vote
1 answer

Why does _getch() still wait for enter instead of directly registering the user input?

I would like to use arrow keys user input without the user having to press enter every time after clicking the arrow. Therefore, I decided to use _getch(), which allegedly does exactly that. It is part of the conio.h library, which I imported.…
HeroCODE
  • 13
  • 4
1
vote
0 answers

ARROWS DETECTION IN C++

I tried to make a simple program to detect the arrows (up, down, right, and left) like shown in my code: #include #include #define up 72 #define down 80 #define right 77 #define left 75 using namespace std; int main(){ …
1
vote
1 answer

How to concatenate a string at the end of another string after using getch

For this code: #include #include #include int main() { std::string a; char c{}; while (c != '\r') { c = getch(); a += c; } a += "xyz"; std::cout << a; } Input: 12345, then…
anonymous38653
  • 393
  • 4
  • 16
1
vote
1 answer

'Porting' conio.h written code to curses.h

I want to port a simple console application to run on Linux terminal with keeping its current behavior as much as possible. It is a little CLI-based game using conio.h at Windows, I would like to port it to Linux. All the conio.h specific lines are…
1
vote
1 answer

How do I use kbhit in C?

#include #include #include #define Ukey 87 #define ukey 119 #define Dkey 115 #define dkey 83 #define Lkey 97 #define lkey 65 #define Rkey 100 #define rkey 68 int main(){ int x=0; int y=0; int prev=rkey; …
dormer
  • 23
  • 4
1
vote
1 answer

Linking Conio functions in Cygwin

I am working on a shared lib that uses a third party library which uses calls to conio lib, when I try to build it using cygwin/g++ I get errors to undefined references to __cprintf __stricmp __splithpath etc.. I link my lib againts,…
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241
1
vote
4 answers

How to use setfillstyle() and textcolor() in C

I want to use setfillstyle() and textcolor() in UBUNTU(terminal) . But I found on internet that it is store in conio.h library which cannot be used in UBUNTU . So what should I do ?
Koolman
  • 127
  • 1
  • 8
1
vote
2 answers

clrscr() not working, getch() working. Why?

I'm making a small C program that asks for a key and executes some code in a switch statement. #include #include int main(int argc, char const *argv[]){ /* code */ printf("Hello, press a, b or c to continue"); char…
1
vote
2 answers

gotoxy() function substitute for Dev C not working

I was looking for a substitute of gotoxy for Dev C++ v5.11 (gcc compiler) and found this: void gotoxy(int x,int y) { printf("%c[%d;%df", 0x1b, y, x); } After this when I tried to call this function as follows: int main() { gotoxy(20, 10); …
Jaladh Singhal
  • 393
  • 4
  • 10
1
vote
1 answer

Weird behaviour of Kbhit and getchar

Consider this block of C++ code. if(_kbhit()){ //printf("Enter\n"); c = getchar(); int d = c; printf("%d", d); //printf("Exit \n"); } The output I get is sd115d100s100 If I press s, d and then d, s.…
user8277998
  • 147
  • 6
1
vote
1 answer

How to pass user input color into textcolor()?

How do I pass a user input color to the textcolor() function in conio.h ? textcolor(BLUE); cprintf("Hello"); works fine, but char c[20]; gets(c); textcolor(c); cprintf("Hello"); throws an error. I didn't expect it to work myself. So the question…
Aswin G
  • 97
  • 2
  • 8
1
vote
2 answers

getch Alternative

As most know getch waits until the user hits a key and then returns the value. Is there a way in order to just check if the user is currently hitting a key? Here is what I'm trying to do: while(1){ char x = getch(); if (x){ //blah } else if(y ==…
Q2Ftb3k
  • 678
  • 3
  • 9
  • 18
1
vote
0 answers

Why does my program stop after inputing a value?

Just started programming with Turbo C++. Why does this simple program not display the additional cprintf functions after I input a value? #include #include main() { float Speed; Speed =0; clrscr(); textcolor(YELLOW); …
PHD6N2
  • 19
  • 3
1
vote
1 answer

Using another header for conio.h

I would like to write a C++ programme on Ubuntu, which reacts immediately to the input without pressing enter. (-> I cannot use the header #include due to the reason that I am working on an UNIX system) For instance: I press on my keyboard…
Coding4Fun
  • 81
  • 1
  • 9
1
vote
2 answers

'ncurses.h' as well as 'conio.h' not found

So I'm using Ubuntu 14.04 LTS and I realized while compiling code using Eclipse CDT as well as general C programs in a text editor executed using the Terminal that the system has no 'conio.h' library file installed. I read up on it, and as an…
Swapneel Mehta
  • 55
  • 1
  • 2
  • 12