omnius wrote:icujc wrote:As far as I can remember <string> is used for Null-terminated character arrays often referred to as C strings
No, definitely not. <string> is for std::string, not C-strings. Any reasonably modern beginner's book should cover this.
The <string> header defines the string type, and is a class template. It provides type saftey to null-terminated strings.
The <cstring> supplys funcionality for null-terminated strings similar to what a string object provides.
<cstring> does not define the string object and <string> does. The string object does not require the use of the functions provided by <cstring> like strcmp(), strcat(), and strncat(). With the string object you can use the overloaded Arithmetic operators and logical operators to perform such tasks as comparing, adding to the begining, or adding to the end.
