string-Related header file resolution (C + +)
1. The following is a familiar header file
String functions provided by the #include <string> C + + standard library
#include <string.h> C standard library
#include <cstring> C + + C + + Enhancements to standard C string processing functions
string is defined as a string class, needless to say, but what String.h and CString have.
*
* * is the C + + version of the Standard C Library header @c string.h, * and its
contents are (mostly) the SAM E as this header, but are all
* contained in the namespace @c std (except for names which are defined
* as macros In C).
*/
That is, the contents of these two files (almost) are the same (except for the names of some of the macros).
Why is that almost the same? is because there is still a difference, in c++11, this function declares:
void *memchr (const void*, int, size_t)//In C * *
Replaced by the following two statements:
void *memchr (void *, int, size_t)/* in C + +
/const void *MEMCHR (const void *, int, size_t)/* in C + + *
In fact, the implementation of 3 functions is the same.
2. In some systems (unix/linux etc.) There is also a header file Strings.h
Strings.h derives from Unix-derived BSD systems, which were later normalized by POSIX, but many of these functions are identified as lagacy (Legacy), most of which can be replaced by other functions:
int bcmp (const void *, const void *, size_t),/* LEGACY, memcmp
/void bcopy (const void *, void *, size_t ); /* LEGACY, memcpy, memmove
/void bzero (void *, size_t),//* LEGACY, and
[memset] /int ffs (int);
Char *index (const char *, int);/* LEGACY, STRCHR * /char *rindex (const char *, int);/* LEGACY, and then Str RCHR * /int strcasecmp (const char *, const char *);
int strncasecmp (const char *, const char *, size_t);
This header file is not used frequently (not in the Windows environment).
3. To say the end of the document, there is still a question to say
<> the difference between a referenced header file and a header file that is referenced: In fact, the search path is different.
The search path for the header file referenced by <> is the system library path;
The search path for the header file referenced is the current path first, and if the current path does not have the file, the system path is searched.
Reference:
The difference between string.h and strings.h