c++中用同时用conio和string

来源:百度知道 编辑:UC知道 时间:2024/05/31 22:05:45
请问c++中同时用到sting类和conio.h的时候。应该怎么声明头文件阿?
就是说用using namespace std;的时候,conio.h 应该改成什么样阿?
(vc 6.0)
比如string.h-> cstring stdlib.h->cstdlib ctype.h->cctype
那么conio.h->?
直接变成cconio貌似编译错误!!
谢谢

conio.h本来就不是C标准的一部分,C++98规定把C的标准头文件加上 "c "前缀去掉 .h 以示区别,这样做是为了向C兼容,以下是C99之后的C标准库头文件,带 * 号的是C99新加入的:

assert.h inttypes.h* signal.h stdlib.h

complex.h* iso646.h stdarg.h string.h

ctype.h limits.h stdbool.h* tgmath.h*

errno.h locale.h stddef.h time.h

fenv.h* math.h stdint.h* wchar.h

float.h setjmp.h stdio.h wctype.h

可见其中并没有conio.h这个头文件,这个头文件应该是某些编译器厂商自行提供的,虽然没有成为标准但因其曾被广泛运用所以现在的编译器一般都加了这个头文件,你要用conio.h的里的实现时直接#include <conio.h>就可以了,因为它不是标准C的一部分所以没有被加上 "c" 前缀...

楼上的回答堪称标准~~~~