It depends on where characters are stored. If you use a character array then the number of actual characters stored in it is calculated with using standard C function strlen
If characters are stored in standard C++ container std::string then there is member function length() or its synonim size() that return the number of characters.