I want to append a char-variable containing the password to a string saying "Your password is: ". When I use the append function for this I get an error saying I can't use this function with string. (I can only use it with unsigned int and char.)
char pass[64];
std::cout << "Enter a password: "; fgets(pass, 64, stdin);
std::string ssifre = "Your password is: "; ssifre.append(sizeof(pass), pass);
If you know another way to solve this, please comment. I don't need to use this function.
This should work:
ssifre += pass;
It's using the += operator
(note that as @MichaelDoubez mentionned in the comments, ssifre.append(pass) would work, too.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With