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
26
votes
12 answers

How to implement getch() function of C in Linux?

In TurboC++, I can use the getch() function from conio.h. But in Linux, gcc doesn't provide conio.h. How can I get the functionality of getch()?
Hits
  • 261
  • 1
  • 3
  • 3
17
votes
5 answers

Using kbhit() and getch() on Linux

On Windows, I have the following code to look for input without interrupting the loop: #include #include #include int main() { while (true) { if (_kbhit()) { if (_getch() == 'g') …
Boxiom
  • 2,245
  • 6
  • 40
  • 51
15
votes
1 answer

cabal FFI dependency

I am making a small Haskell game in Windows, where I would like to respond each time the user presses a key. Because getChar behaves strangely on Windows, I use FFI to get access to getch in conio.h, as described here. The relevant code is: foreign…
Boris
  • 5,094
  • 4
  • 45
  • 71
14
votes
2 answers

Why use conio.h?

I often see people use the header file of conio.h in C and C++, although I can´t see any major benefits in use of the functions inside of conio.h in comparison to the standard library functions. conio.h has furthermore the disadvantages of being…
9
votes
1 answer

How do I port this program from conio to curses?

I wrote this simple program on Windows. Since Windows has conio, it worked just fine. #include #include int main() { char input; for(;;) { if(kbhit()) { input = getch(); …
Veselin Romić
  • 703
  • 6
  • 11
7
votes
5 answers

How could I achieve gotoxy() in gcc

I am using gcc in ubuntu.so, I compile and execute in terminal. But In a online programming contest, they require the output as shown in diagram. For that, if I use TURBOC I can get it using conio.h using gotoxy() to get spiral format of output.…
Muthu Ganapathy Nathan
  • 3,199
  • 16
  • 47
  • 77
7
votes
1 answer

Unresolved inclusion: . Why?

While running a simple c program I receive an Unresolved inclusion: What am I missing? I am using eclipse on fedora 13. Please help me resolve this problem. If I am missing any file or haven't installed anything let me know. Also I am…
Najam Awan
  • 71
  • 1
  • 4
7
votes
2 answers

conio.h is missing from Windows

I usually use VS but trying cygwin for the first time. I am using windows 7 but on compiling hello world program using gcc, it says "fatal error: conio.h: no such file or directory". I am using Windows 7 and it seems conio.h is missing from my…
Satya Ashok Kumar
  • 103
  • 1
  • 1
  • 4
7
votes
3 answers

How to use getch() without waiting for input?

for (;;) { cout << "You are playing for:" << playtime << "seconds." << endl; cout << "You have " << bytes << " bytes." << endl; cout << "You are compiling " << bps << " bytes per second." << endl; cout << "Press a to buy assembler…
Fairlight
  • 79
  • 1
  • 4
7
votes
1 answer

What does getch() really get? Scan codes?

#include int main (void) { for (;;) { unsigned char ch = getch(); printf ("0x%02X\n", ch); } } I want to get the scan code. Here is the description from Wikipedia: Reads a character directly from the…
Kevin Dong
  • 5,001
  • 9
  • 29
  • 62
4
votes
3 answers

conio.h doesn't contain textcolor()?

I've been looking at using colours in a DOS program I'm writing in C. I was told that conio.h has the textcolor() function, but when I use it in my code, the compiler/linker throws errors at me saying I've an undefined reference to the…
phillid
  • 198
  • 1
  • 11
4
votes
1 answer

Is there a simple way to clean screen/hold the output window in CLI with an interoperable code, avoiding conio.h and ncurses.h?

I have just started computer science studies. The programming teacher chose C++ to teach us procedural programming, and therefore gives us code samples and exercises. The first sample we got was a CLI “Find the right number” game. The really first…
Poulpette
  • 51
  • 4
3
votes
1 answer

getch returns -1?

They asked how to capture keys such as F11 or insand getchr does not return anything for those keys, and there is nothing I can find working that accepts raw input from input events.. I am now trying ncurses/curses in a C++ program to capture these…
John
  • 1,110
  • 3
  • 14
  • 28
3
votes
2 answers

How to run program whilst listening for user input in C?

I'm trying to make a game that continues running until a key is pressed and then it should take that key in and do something with it then continue running as per normal. How do I do this? I'm on MAC so even though I've come across a windows library…
Ikki
  • 33
  • 1
  • 5
3
votes
1 answer

How to print text in a specific position?

#include #include #include #include #include #define MAX 25 main(){ int a[MAX],i,j,lvl=2,score=0; float time=1.0,speed; speed=time/lvl; clrscr(); for(i=0;i
third_
  • 67
  • 1
  • 2
  • 6
1
2 3 4 5 6 7 8