-7

First of all.... I can't include 'conio' in my file (nor 'conio.h') and then I can't use 'clrscr()' in my program...

The code is like this

#include<iostream>
#include<conio>         \\even 'conio.h' isn't working

main()
{
    clrscr();
}

It shows an error like this...

/home/myni/Documents/Codes/CPP/Anjuta/src/main.cc:2:16: fatal error: conio: No such file or directory

And when I remove the 'conio' header file, it shows something like this...

/home/myni/Documents/Codes/CPP/Anjuta/src/main.cc:5:9: error: ‘clrscr’ was not declared in this scope
Heich-B
  • 672
  • 1
  • 6
  • 15

2 Answers2

2

From Wikipedia:

conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output.[1] It is not part of the C standard library or ISO C, nor is it defined by POSIX.

In short: Your program is not portable to Unix (or in fact, anything but MSDOS or Win32).

So unless you're using an environment that has this (Microsoft compiler), you'll need to find something else to do console manipulation. I recommend ncurses if you need low-level functions to deal with the console.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94
1

Looks like you're trying to run the program on Linux. I did this with Ubuntu some time ago and I think this should work for you.

system("clear");

This is how I cleared the screen. I hope this helps.

itsols
  • 5,406
  • 7
  • 51
  • 95