刚刚开始写程序的时候很疑惑哪来这么多头文件的,哪个该加,哪个不该加,为什么要加这个头文件…………
其实在linux下很简单的就可以判断,比如我需要用到bzero()这个函数【功能,置字节字符串s的前n个字节为零】
我在终端里man一下:
man bzero
系统会给出这个函数的说明和用法
BZERO(3) Linux Programmer’s Manual BZERO(3)
NAME
bzero - write zero-valued bytes
SYNOPSIS
#include <strings.h>
void bzero(void *s, size_t n);
DESCRIPTION
The bzero() function sets the first n bytes of the byte area starting at s to zero (bytes containing
’/0’).
RETURN VALUE
None.
CONFORMING TO
4.3BSD. This function is deprecated (marked as LEGACY in POSIX.1-2001): use memset() in new programs.
其中就有#include<strings.h>,这个就是bzero()需要调入的头文件!