Error C2664

Problem:
I am getting an error message. I do not know why because the "p.password" is declared as a string in the class.

Error Message:
error C2664: 'size_t strlen(const char *)' : cannot convert argument 1 from 'std::string' to 'const char *'

Here is the code:
1
2
3
4
5
	// Password size validation
	while (strlen(p.password) < 6 || strlen(p.password) > 18)
        {
             // Stuff
        }
strlen only works with char pointers (aka C strings). Use p.password.length() instead.

http://www.cplusplus.com/reference/string/string/length/
Topic archived. No new replies allowed.