0
votes

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>

4

4 Answers

1
votes

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.

0
votes

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 )

0
votes

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

0
votes

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.