Are you using std::string ?? if yes use the string::size() method
Are you using raw strings , ie char array ., make sure it has extra 1 byte space for terminating null character , ie '\0'.strlen will work on char array with last byte having '\0' char.
Anyways the question is vague & needs more info for addressing issue.