0

As in C++ header files are used without .h extension like <iostream> instead of <iostream.h> but its not same in case of <conio.h>. Why we can't use <conio>

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Faisl naseer
  • 11
  • 1
  • 1
  • 6

4 Answers4

1

The C++ standard specifies which headers are part of the C++ standard library. In addition to C++-specific headers, it includes the headers specified by the C standard. You can use them with their C names (e.g., #include <stdio.h>), and they put their symbols into the global namespace. You can use them without the .h extension and a c on the front (e.g., #include <cstdio>), and they put their symbols into the namespace std.

But that's only for the headers from the C standard. conio.h is not part of the C standard, so the C++ standard doesn't say anything about it.

Pete Becker
  • 74,985
  • 8
  • 76
  • 165
0

conio.h is a C header, thus (traditionally) C headers had the .h extension for the system headers. C++ standard headers are mainly without this .h extension. As you may know, many C headers (those from the standard library) have C++ counterparts (like in C++ is )

asalic
  • 949
  • 4
  • 10
0

Because conio.h is a C header, not C++ specific.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
0

conio isn't part of the c++ standard, so you can't count on the compiler to know what it is. :(

In fact, i think it's usually only supported under windows.

yamafontes
  • 5,552
  • 1
  • 18
  • 18