Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to pass variable in C Sprintf 2nd(format) argument?
- string format = "what is your %s";
- new_string = sprintf(buffer, format, name);
- string format = "what is your %s";
- int total = sprintf(buffer, format.c_str(), name);
- std::ostringstream os;
- os << "what is your " << name;
- std::string new_string = os.str();
- char buffer[100];
- string format = "what is your %s";
- sprintf(buffer, format.c_str(), name.c_str());
- string new_string(buffer);
- stringstream buf;
- buf << "what is your " << name;
- string new_string = buf.str();
- int len = sprintf(buffer, "what is your%s", name);
- std::string new_string(buffer, len);
Advertisement
Add Comment
Please, Sign In to add comment