LIBRARY FUNCTIONS FOR STRINGS
The standard library provides the cstring header that contains functions that operate on null-terminated strings. These are a set of functions that are specified in the C++ standard. There are also alternatives to some of these functions that are not standard, but which provide a more secure implementation of the function than the original versions. In general, I’ll mention both where they exist in the cstring header, but I’ll use the more secure versions in examples. Let’s explore some of the most useful functions provided by the cstring header.
Finding the Length of a Null-Terminated String
The strlen() function returns the length of the argument string of type char* as a value of type size_t. The type size_t is an implementation-defined type that corresponds to an unsigned ...
Get Ivor Horton's Beginning Visual C++ 2012 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.