LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-11-2003, 07:27 PM   #1
matt_w_lambert
Member
 
Registered: Jan 2003
Location: WA
Distribution: Red Hat 9.0, mandrake 9.2
Posts: 194

Rep: Reputation: 30
conio.h


i just started to learn c programing from an old book and it says to use the conio.h header file but when i compil it says there is no such thing.
 
Old 07-11-2003, 07:30 PM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
conio is i believe the dos implementation of curses.
 
Old 07-12-2003, 12:46 AM   #3
shellcode
Member
 
Registered: May 2003
Location: Beverly Hills
Distribution: Slackware, Gentoo
Posts: 350

Rep: Reputation: 32
you cant....

conio is only used by the Borland compilers i believe....

you should use ncurses

IMHO:
who needs console grafix anyway...either make a console app or go all the way and make it a GUI app
 
Old 07-12-2003, 04:13 AM   #4
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
Quote:
IMHO:
who needs console grafix anyway...either make a console app or go all the way and make it a GUI app
ever compiled a kernel on a machine that doesnt have X?
 
Old 07-12-2003, 05:04 AM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Or, ever used 'mc'?
 
Old 07-12-2003, 05:40 AM   #6
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Rep: Reputation: 30
http://www.linuxquestions.org/questi...threadid=45919
 
Old 07-12-2003, 05:59 AM   #7
nautilus_1987
Member
 
Registered: Aug 2002
Distribution: Slackware 8.1
Posts: 750

Rep: Reputation: 30
Everything is simple people, conio header uses simple Windows callings that are defined in windows.h. That is the part of code I used in one of my programs, I have taken the code from conio.c.
Code:
//Windows Callings
//==============================================================================//
//Clean Screen Function (only for Windows)
void clrscr() {
  COORD coord;
  DWORD written;
  CONSOLE_SCREEN_BUFFER_INFO info;

  coord.X = 0;
  coord.Y = 0;
  GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
  FillConsoleOutputCharacter (GetStdHandle(STD_OUTPUT_HANDLE), ' ',
    info.dwSize.X * info.dwSize.Y, coord, &written);
  gotoxy (1, 1);
}

//GOTO x or Y
void gotoxy(int x, int y) {
  COORD c;
  c.X = x - 1;
  c.Y = y - 1;
  SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
}
void textbackground(int _color) {
  if (_color == BLINK)
     _color = WHITE;
  __BACKGROUND = _color;
  textattr (__FOREGROUND | (_color + 29));
}

void textcolor(int _color) {
  if (_color == BLINK)
     _color = WHITE;
  __FOREGROUND = _color;
  textattr(_color | __BACKGROUND);
}

void textattr(int _attr) {
  SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), _attr);
//  printf ("%d\n", text_info.screenheight);
}
//===============================================================================//
so no conio.h in Linux. But ncurses are used for that
 
Old 07-13-2003, 11:50 PM   #8
vapor
Member
 
Registered: Jul 2003
Distribution: SuSe
Posts: 38

Rep: Reputation: 15
nake ur own header
 
Old 07-18-2003, 09:46 AM   #9
DIYLinux
Member
 
Registered: Jul 2003
Location: NL
Distribution: My own
Posts: 92

Rep: Reputation: 18
If I remember correct, conio is indeed a Borland invention. It was a very thin layer over the M$ DOS library (its not an OS). It was a buit lighter than a full stdio implementation. Later, other C compiler vendors in the M$ world started supporting it (I remember Watcom C/C++).

Conio typical use was to do user interaction. You could see if a key was pressed without waiting using _kbhit. In the UNIX world, your best bet is to use select(2) on the file descriptor 0 (the one stdin uses). If you do not like BSDisms, try SYSV style poll. Both are available on Linux and glibc systems.

Other functions can b e reasonably approximated with the stdio functions. _getch is a bit harder, because it does not echo. You will have to check that you are talking to a tty (see isatty(3)), and turn echo off. See the low level I/O and serial line stuff in your glibc documentation. Or, check the source code login.c in util-linux.

Anyway, here (http://www.digitalmars.com/rtl/conio.html) is a short reference of conio.h. Copy the header to your /usr/include and enjoy reimplementing some 20 year old obsolete library.
 
Old 07-19-2003, 12:04 AM   #10
shellcode
Member
 
Registered: May 2003
Location: Beverly Hills
Distribution: Slackware, Gentoo
Posts: 350

Rep: Reputation: 32
Quote:
Originally posted by kev82
ever compiled a kernel on a machine that doesnt have X?
i suppose there are some exceptions to what i said but for the most part its annoying.

also: notice the IMHO.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ncurses and conio help... darkarcon2015 Programming 3 01-02-2005 03:20 PM
conio.h?? jojopopo0372 Programming 3 09-07-2004 03:11 AM
ConIO.h Mohsen Linux - General 4 09-04-2004 03:46 PM
conio.h ??? Umanga Programming 3 09-02-2004 05:06 PM
Conio Mohsen Programming 6 02-19-2003 02:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration