<string.h> 之间的区别和 <strings.h> [英] Difference between <string.h> and <strings.h>

查看:19
本文介绍了<string.h> 之间的区别和 <strings.h>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到(至少在 Mac OS X 上)<string.h> 标头和 <strings.h> 标头都有.man 3 string 表明他们包含不同的功能.这有什么原因吗?

I noticed that there was (at least on Mac OS X) both a <string.h> header and a <strings.h> header. man 3 string reveals that they contain different functions. Is there any reason for this?

推荐答案

strings.h 来自 unix 进化中的 BSD 分支.它的内容已经被 POSIX 标准化了,但是大部分都被标记为 legacy 并且可以很容易地被其他函数替换:

strings.h comes from the BSD branch in the unix evolution. Its content has been standardized by POSIX, but most of it is marked as legacy and can be easily replaced with other functions:

int    bcmp(const void *, const void *, size_t); /* LEGACY, see memcmp */
void   bcopy(const void *, void *, size_t); /* LEGACY, see memcpy, memmove */
void   bzero(void *, size_t); /* LEGACY, see memset */
int    ffs(int);
char  *index(const char *, int); /* LEGACY, see strchr */
char  *rindex(const char *, int); /* LEGACY, see strrchr */
int    strcasecmp(const char *, const char *);
int    strncasecmp(const char *, const char *, size_t);

这篇关于&lt;string.h&gt; 之间的区别和 &lt;strings.h&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆