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

查看:83
本文介绍了< 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标准化,但是大多数被标记为旧版,可以很容易地用其他功能替换:

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天全站免登陆